473,387 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Need helps with date and time in PHP/MySQL


Hi folks,
I need help regarding date and time comparison in PHP and MySQL
My website is hosted in the USA (GMT - 8)
And It is managed in Madagascar (GMT + 3)
Want to consider DATE in Madagascar not in USA -
MySQL CONVERT_TZ's function doesn't work

So, how can I do the following:
1. Today's visits
$query = "SELECT count(*) FROM visits WHERE now() = date";

2. Articles on the website appear only after 6 AM (GMT +3) compared to
the date_publication
$query = "SELECT n_edition FROM $table WHERE NOW() >
DATE_SUB(date_publication, INTERVAL 16 HOUR) ORDER BY n_edition DESC
LIMIT 1" ;

I don't know how to use DATE_ADD and DATE_SUB regarding the problem
below.
Notes that either visits.date and editions.date is recorded on the
server GMT -8

Any help could be appreciated

Nov 20 '06 #1
1 1617
rija wrote:
Hi folks,
I need help regarding date and time comparison in PHP and MySQL
My website is hosted in the USA (GMT - 8)
And It is managed in Madagascar (GMT + 3)
Want to consider DATE in Madagascar not in USA -
MySQL CONVERT_TZ's function doesn't work

So, how can I do the following:
1. Today's visits
$query = "SELECT count(*) FROM visits WHERE now() = date";

2. Articles on the website appear only after 6 AM (GMT +3) compared to
the date_publication
$query = "SELECT n_edition FROM $table WHERE NOW() >
DATE_SUB(date_publication, INTERVAL 16 HOUR) ORDER BY n_edition DESC
LIMIT 1" ;

I don't know how to use DATE_ADD and DATE_SUB regarding the problem
below.
Notes that either visits.date and editions.date is recorded on the
server GMT -8

Any help could be appreciated
Since you're asking about MySQL operations and not PHP, might I suggest
you ask in comp.database.mysql - where all the MySQL users hang out?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 20 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Dominique Javet | last post by:
Hello, I'm new to php and mysql and I use Dreamweaver MX 2004, so sorry for this "newbie" question... I've found no answer in the forum ... I've a date problem with my formular. In my mysql DB...
3
by: Noyb | last post by:
How do I convert a string into a value I can upload to mysql date field. Specifically, I have a user select a month, day and year from drop-downs, then I want them submitted to one date field....
3
by: JA | last post by:
I am trying to pull a time stamp out of a database,looks like this 2004-06-24 10:12:03 . Then I need to substring it so that I can take a difference of 2 times. Basically I making a clock...
1
by: Dave Posh | last post by:
I seem to be having a problem displaying time stored in mysql. The format stored in the database is 13:15:05. The database data type is time. I'm using asp vbscript and sql to retrieve the time...
7
by: Charles Crume | last post by:
Hello all; I have used dBASE, and other computer languages/databases, for years. They all have a logical field type. However, the version of MySQL used by the ISP hosting my site does not...
3
by: parksch2 | last post by:
I have been trying and trying to properly sort records through a mySQL query. I have hour, minute and AM/PM values stored separately in a database as varchars. I'm trying to concat those, cast them...
1
by: Rotsj | last post by:
Hi, i'm using visual foxpro 9 with a mysql 5 database, for direct access to my database i use navicat. In visual foxpro i've set my date format to dd-mm-yyyy, also i did this in navicat. However...
6
by: Geoff Cox | last post by:
Hello, at the moment I can add the combined date and time into MySQL using php $dt1 = date("Y-m-d H:i:s"); is it possible to add the date and time separately? I thought it might be
8
by: Path9898 | last post by:
hello, i need some help with getting time out of a mysql db. I have a page that lets you enter in your name and submit to a mysql db. In the db the table row is called appt_time and has a Datatype...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.