![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| ||||
| ||||
|
|
unix_timestamp('1970-01-02 00:00:00')-unix_timestamp('1970-01-01 00:00:00') | +-----------------------------------------------------------------------------+ 82800 | +-----------------------------------------------------------------------------+ |
|
unix_timestamp('1970-01-03 00:00:00')-unix_timestamp('1970-01-02 00:00:00') | +-----------------------------------------------------------------------------+ 86400 | +-----------------------------------------------------------------------------+ |
|
unix_timestamp('1970-01-02 00:00:00') | +---------------------------------------+ 82800 | +---------------------------------------+ |
|
unix_timestamp('1970-01-01 01:00:00') | +---------------------------------------+ 0 | +---------------------------------------+ |
#2
| |||
| |||
|
|
Look at this (mysql 5.1.30 solaris x86-64): mysql> select unix_timestamp('1970-01-02 00:00:00')- unix_timestamp('1970-01-01 00:00:00'); +-----------------------------------------------------------------------------+ | unix_timestamp('1970-01-02 00:00:00')-unix_timestamp('1970-01-01 00:00:00') | +-----------------------------------------------------------------------------+ | 82800 | +-----------------------------------------------------------------------------+ mysql> select unix_timestamp('1970-01-03 00:00:00')- unix_timestamp('1970-01-02 00:00:00'); +-----------------------------------------------------------------------------+ | unix_timestamp('1970-01-03 00:00:00')-unix_timestamp('1970-01-02 00:00:00') | +-----------------------------------------------------------------------------+ | 86400 | +-----------------------------------------------------------------------------+ mysql> select unix_timestamp('1970-01-02 00:00:00'); +---------------------------------------+ | unix_timestamp('1970-01-02 00:00:00') | +---------------------------------------+ | 82800 | +---------------------------------------+ mysql> select unix_timestamp('1970-01-01 01:00:00'); +---------------------------------------+ | unix_timestamp('1970-01-01 01:00:00') | +---------------------------------------+ | 0 | +---------------------------------------+ Where the heck is the first hour ??? All unix_timestamps are wrong by this mysterious hour, so unix_timestamp is the number of seconds since '1970-01-01 01:00:00', not '1970-01-01 00:00:00', as all MySQL documents are pretending: " If UNIX_TIMESTAMP() is called with a date argument, it returns the value of the argument as seconds since '1970-01-01 00:00:00' UTC. " This is simply not true. |
#3
| |||
| |||
|
|
Because your system's timezone is set to UTC-1 currently. The manual is correct and matches UNIX's clock. |
#4
| |||
| |||
|
|
Jerry Stuckle wrote: Because your system's timezone is set to UTC-1 currently. The manual is correct and matches UNIX's clock. No, it's set to UTC+1 + DST, but this shouldn't affect the very first hour in 1970. Ok, I see the kludge: 1970-01-01 00:00:00 UTC IS 1970-01-01 01:00:00 |
#5
| ||||
| ||||
|
|
Because your system's timezone is set to UTC-1 currently. Ok, I see the kludge: 1970-01-01 00:00:00 UTC IS 1970-01-01 01:00:00 in my timezone, so that's actually my zeropoint for unix_timestamp(), since unix_timestamp is TZ dependent. Tricky. |
|
Variable_name | Value | +------------------+--------+ system_time_zone | CEST | time_zone | SYSTEM | +------------------+--------+ |
|
convert_tz('1970-01-02 00:00:00', @@time_zone, 'GMT') | +-------------------------------------------------------+ 1970-01-01 23:00:00 | +-------------------------------------------------------+ |
|
x | +-------+ 86400 | +-------+ |
![]() |
| Thread Tools | |
| Display Modes | |
| |