echo strtotime('2010-09-11 12:15:01');
Returns: 1284207301
SELECT UNIX_TIMESTAMP('2010-09-11 12:15:01')
Returns: 1284200101
Why the difference?
Returns: 1284207301
Returns: 1284200101 Why the difference? |
||||
|
This is commonly caused by setting PHP and MySQL to use different timezones, as well as discrepancies in the system time if they happen to be located in different servers. UNIX timestamps are the number of seconds that have passed since the UNIX epoch on midnight January 1, 1970 UTC so timezone differences will give different timestamps. |
|||||||||||
|
The answer is in the php.net article about strtotime:
Short version: strtotime uses your timezone by default, UNIX_TIMESTAMP does not. |
|||
|
|
|||
|
My guess is that Unix time is GMT and the other is your local timezone, there is exactly 2 hours difference (7200/60/60) between the 2 outputs |
|||
|