Home » Php » GMT vs UTC dates

GMT vs UTC dates

Posted by: admin November 29, 2017 Leave a comment

Questions:

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?

Answers:

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

Questions:
Answers:

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

For your purposes, they are the same.

Questions:
Answers:

The practical difference is that if a system is set up to use UTC then it will not automatically switch to daylight savings time while if you set your time zone to GMT then there’s a good chance it automatically switches to BST during the summer without you noticing.

Questions:
Answers:

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