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 JavaScri开发者_如何学运维pt is set to UTC; how do these standards differ, and could this be causing the problem?
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
One is measured from the sun and another from an atomic clock.
For your purposes, they are the same.
For computers, GMT is UTC+0 - so they are the equivalent.
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.
精彩评论