I have my server synced to UTC, which is currently 2013-05-23 18:13:56
give or take.
When I run date("Y-m-d H:i:s")
, I get 2013-05-24 07:13:56
.
I checked the php.ini file, the timezone is set date.timezone = 'UTC'
, which I thought would change the timezone to reflect against what the system's timezone setting is. So I turned it off (like this: ;date.timezone = 'UTC'
) and I still get an incorrect timestamp.
All this wibbly wobbly timey wimey stuff has got me more confused that a Dalek with a valentines day card.
Suggestions?
UTC is a reference, not a time zone.
Every country/zones are refered to UTC.
You should use the time zone of the country you need to use the time.
For example:
date_default_timezone_set('Europe/London');
date("Y-m-d H:i:s");
Note: Europe/London is UTC+1 (weird eu ? UTC is supposed to be greenwich that pass through London BUT UK uses time savings so the difference)
server time should be correct either, putting it to "UTC" does not mean either a good thing, if is more importante your server is at the "correct time" for the "correct timezone"
How to know which time zone is the server: from console, type:
$ date
and the server responds with the time:
Thu May 23 13:22:23 CDT 2013
Note the CDT, it's the time zone. Which time zone uses your server ?
What I have found is that my T.A.R.D.I.S. will set itself to the local time, so wherever it finds itself, that is where my SQL will set itself. Therefore, I always make sure my Ubuntu uses the correct time zone. It's the system time, not just SQL time. Less wibbly wobbly that way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With