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
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.
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.
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:
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.
I’m guessing you’re using PHP < 5.4
The default timezone used by all date/time functions. Prior to PHP 5.4.0, this would only work if the TZ environment variable was not set. The precedence order for which timezone is used if none is
explicitly mentioned is described in the date_default_timezone_get()
page. See List of Supported Timezones for a list of supported