dtleahy
asked on
Server time, not local user's time (php, mySQL)
A quick question:
Timezones around the world... users in different timezones.
I need to compare when a record was updated, not based on local time, but on server time.
I have a datetime field in mySql, default is: 0000-00-00 00:00:00
I have a form, and that form processing should update a field in a record. If someone in London and someone in Chicago update their record nearly simultaneously, the database should show the times as whatever was correct at the server at the time, not local time. Even though Peter and Paul are 6 hours apart in time zones, if they update nearly simultaneously, I would want:
2012-03-24 23:49:03 Peter, London
2012-03-24 23:49:00 Paul, Chicago
Will the php function Now() update the record with server time, or local time? If local, then what function do I need to use, instead.
Thanks!
Dennis
Timezones around the world... users in different timezones.
I need to compare when a record was updated, not based on local time, but on server time.
I have a datetime field in mySql, default is: 0000-00-00 00:00:00
I have a form, and that form processing should update a field in a record. If someone in London and someone in Chicago update their record nearly simultaneously, the database should show the times as whatever was correct at the server at the time, not local time. Even though Peter and Paul are 6 hours apart in time zones, if they update nearly simultaneously, I would want:
2012-03-24 23:49:03 Peter, London
2012-03-24 23:49:00 Paul, Chicago
Will the php function Now() update the record with server time, or local time? If local, then what function do I need to use, instead.
Thanks!
Dennis
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, Ray!
Excellent info at that link! Thank you so much for taking the time (a few years ago) to amass that accumulated knowledge into what is a whitepaper. Great resource!
In my current programming situation, the only thing this datetime field will be used for is to do an ORDER BY in the SQL statement. I'll never display the field data and the people around the world will never need to know the offset from GMT, or do any datetime math for example.
This has nothing to do with auctions, but as a good example, imagine an item being auctioned off and people around the world are bidding. I would need to know what time they hit the server, not what time it was at their particular locality.
The exact reason I want this is so that I can display a list of the most recent 10 people that have signed-up to a website I'm building, (no matter where they are in the world.)
Dennis
Excellent info at that link! Thank you so much for taking the time (a few years ago) to amass that accumulated knowledge into what is a whitepaper. Great resource!
In my current programming situation, the only thing this datetime field will be used for is to do an ORDER BY in the SQL statement. I'll never display the field data and the people around the world will never need to know the offset from GMT, or do any datetime math for example.
This has nothing to do with auctions, but as a good example, imagine an item being auctioned off and people around the world are bidding. I would need to know what time they hit the server, not what time it was at their particular locality.
The exact reason I want this is so that I can display a list of the most recent 10 people that have signed-up to a website I'm building, (no matter where they are in the world.)
Dennis
ASKER
Thanks, Dave and Ray! You guys are gems!<br />-Dennis
ASKER
So...
(from the php file)
Open in new window
Simple as this?
Do I need to format it at all? I don't need to display the data in the zdatetime field, I just need to make a comparison, so I can (for example) query to get the last 10 people who have activated.
Dennis