unixtimestamp values are not liner? In the following example, I was expecting the 599 date value to be lesser than the second 600 value.
mysql> select from_unixtime(1289109599);
+---------------------------+
| from_unixtime(1289109599) |
+---------------------------+
| 2010-11-07 01:59:59 |
+---------------------------+
1 row in set (0.00 sec)
mysql> select from_unixtime(1289109600);
+---------------------------+
| from_unixtime(1289109600) |
+---------------------------+
| 2010-11-07 01:00:00 |
+---------------------------+
1 row in set (0.00 sec)
mysql> select from_unixtime(1289109601);
+---------------------------+
| from_unixtime(1289109601) |
+---------------------------+
| 2010-11-07 01:00:01 |
+---------------------------+
1 row in set (0.00 sec)
When I tried similar commands on some other server, I got the following output…
mysql> select from_unixtime(1289120399);
+---------------------------+
| from_unixtime(1289120399) |
+---------------------------+
| 2010-11-07 01:59:59 |
+---------------------------+
1 row in set (0.00 sec)
mysql> select from_unixtime(1289120400);
+---------------------------+
| from_unixtime(1289120400) |
+---------------------------+
| 2010-11-07 01:00:00 |
+---------------------------+
1 row in set (0.00 sec)
mysql> select from_unixtime(1289120401);
+---------------------------+
| from_unixtime(1289120401) |
+---------------------------+
| 2010-11-07 01:00:01 |
+---------------------------+
1 row in set (0.00 sec)
Update: Due to DST, I am getting the same timestamp for two different unix time values. Interesting!
mysql> select from_unixtime(1289109600);
+---------------------------+
| from_unixtime(1289109600) |
+---------------------------+
| 2010-11-07 01:00:00 |
+---------------------------+
1 row in set (0.00 sec)
mysql> select from_unixtime(1289106000);
+---------------------------+
| from_unixtime(1289106000) |
+---------------------------+
| 2010-11-07 01:00:00 |
+---------------------------+
1 row in set (0.00 sec)
This is a DST issue.
Your mySQL server is in a time zone in which DST ended November 7, 2010 at 02:00. Clocks were turned back to 01:00, hence the discrepancy.
More on mySQL’s time zone support in the manual.