我的时区是UTC + 8,但是当我跑
时<div id="data"></div>
我得到了“1970-01-01 07:30:00”而不是“1970-01-01 08:00:00”。
我跑了:
mysql> select from_unixtime(0);
+---------------------+
| from_unixtime(0) |
+---------------------+
| 1970-01-01 07:30:00 |
+---------------------+
然后我得到了:
show variables like "%time_zone%";
答案 0 :(得分:1)
假设您在新加坡,1970年该地区的时区为GMT +7.5。直到1982年,才开始使用GMT +8的现值。
Period in use Time offset from GMT Reference Meridian Name of Time
... 1905 May 31 + 6hr 55m 25s 103 51 16 E Singapore Mean Time
1905 Jun 01 - 1932 Dec 31 + 7hr 00m 00s 105 00 00 E Standard Zone Time
1933 Jan 01 - 1941 Aug 31 + 7hr 20m 00s 110 00 00 E Daylight Saving Time
1941 Sep 01 - 1942 Feb 15 + 7hr 30m 00s 112 30 00 E Daylight Saving Time
1942 Feb 16 - 1945 Sep 12 + 9hr 00m 00s 135 00 00 E Tokyo Standard Time @
1945 Sep 13 - 1981 Dec 31 + 7hr 30m 00s 112 30 00 E DST/MST/SST # @
1982 Jan 01 - Present + 8hr 00m 00s 120 00 00 E Singapore Standard Time