GMT vs UTC dates

余生颓废 提交于 2019-11-27 13:27:55

问题


I have a calendar built in JavaScript that compares dates with PHP. The JavaScript date object is set using PHP, but, when I compare future dates, they appear to be out of sync.

PHP is set to GMT and JavaScript is set to UTC; how do these standards differ, and could this be causing the problem?


回答1:


From Coordinated Universal Time on Wikipedia:

Coordinated Universal Time (UTC) is a time standard based on International Atomic Time (TAI) with leap seconds added at irregular intervals to compensate for the Earth's slowing rotation.

From Greenwich Mean Time on Wikipedia:

UTC is an atomic time scale which only approximates GMT with a tolerance of 0.9 second




回答2:


One is measured from the sun and another from an atomic clock.

For your purposes, they are the same.




回答3:


For computers, GMT is UTC+0 - so they are the equivalent.




回答4:


If you strictly go by the definition of what UTC and GMT are, there is no real practical difference as others have pointed out.

However one needs to be careful as there are certain cases where (possibly legacy) terminology is used such as in the Microsoft Timezone index values

The difference is that in that context, what is referred to as the "GMT timezone" (code 55) is, in reality, the "GMT locale" which is the locale used by Dublin, Edinburgh, Lisbon, London (all of which observe daylight savings time) which is differentiated from Greenwich Standard Time (code 5A) which is used by Monrovia and Reykjavik both of which do not observe daylight savings time.

The practical difference is that if a system is set up to use UTC (code 80000050 under the semantics specified above) then it will not automatically switch to daylight savings time while if you set your time zone to GMT (code 55) then there's a good chance it automatically switches to BST during the summer without you noticing.



来源:https://stackoverflow.com/questions/1612148/gmt-vs-utc-dates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!