为何 UNIX 时间 0, 有时显示是1970年1月1日,有时显示是1969年12月31日

by Rachael Arnold

http://www.rachaelarnold.com/dev/archive/why-is-date-returning-wrong

Demystifying 12/31/1969 (or 1/1/1970 for Eastern Hemisphere folk)

Since the Unix timestamp is based off the Unix Epoch, an invalid timestamp defaults to to the Epoch (Thu, 01 Jan 1970 00:00:00 +0000).

But, date() displays the formatted time taking into account the timezone of the server or a timezone set with date_default_timezone_set(), so if your timezone is set to something like America/New_York (-0500), the date will be adjusted, resulting in a time that falls during 31 Dec 1969.

So if your server or script timezone is set to a timezone in the Western Hemisphere, any invalid timestamps will end up displayed as some incarnation of 31 Dec 1969. Likewise, in the Eastern Hemisphere, the date falls on or after the Epoch, resulting in a returned value of 1 Jan 1970.


Read more: http://www.rachaelarnold.com/dev/archive/why-is-date-returning-wrong#ixzz5uaAUwhlP
上一篇:KVM安装凝思8解决鼠标漂移的问题


下一篇:ValhallaDSP Valhalla VintageVerb for Mac(混响插件)