PHP - DateTime Formatting | PHP-DateTime-Demo | Explained


Modern Basics of Planetary Time:

As the Earth spins, the sun shines on only part of the planet at any time...
High-Noon is traditionally the highest point the sun will reach in the sky on any particular day.
That makes a pretty easy marker to use to set clocks.

However, high-noon moves, as the Earth moves, rotating around the Earth taking, well, what we call a "day" to come back to more-or-less the same spot.

If we always wanted to be accurate to Sun-Time, we would have to adjust our clocks every few miles to make sure they matched local high-noon, and then nobody's clocks would agree. So...

A while ago, Britain with its vast empire and likewise vast Navy, decided to set a single time standard, using the Royal Observatory in Greenwich, England. As clocks were already using a standard 24-hour day, the globe was divided into 24 segments, along longitudinal lines, marked using the Royal Observarory in Greenwich as Longitude 0 or the "Prime-Meridian", and therefore Time Zone 0. And thus, we got Greenwich Mean Time or GMT. With Each Time-Zone stretching away from the Prime-Meridian at about 1,670 kilometers wide (at the Equator) - conveniently about 1,000 miles.

The reality was a lot more messy than my simple explanation, but eventually folks around the world got used to 24 time-zones measured relative to GMT. Then we added Day-Light-Savings time to really mess things up again.

But, as our clocks got more precise and as coordinating time around the globe became more important, we needed something more precise than the GMT standard. So an international-standard-time was established, and we got Coordinated Universal Time or "UTC".
GMT became just another Time-Zone, like Pacific Standard Time...

I will skip discussion of Atomic clocks and leap-seconds... since our EPOCH time ignores leap-seconds...

So, we now work with UTC standard time, which is still related to the position of the sun, but measured with atomic clocks.
The Royal Observatory Still sits on the Prime-Meridian and therefore is at UTC 0000.


Enough History?

Lets try Relative Time...

The international standard now assumes time relative to a clock on the Prime-Meridian, with the 24 major time-zones marked roughly equally from that point. Time measurement now needs to include not only the clock measurement we are used to, but an offset measurement from UTC-0 as well.

How about a concrete example:

The Tohoku Earthquake in Japan, occurred at 05:46 UTC on the date 2011-03-11.
Japan sits at UTC +9, so the Earthquake would have been at 14:46 local time of the same date (I don't know about daylight-savings here...)

But, where I live, I heard about it, the day before... since I sit at UTC -8, so by my local time it was 9:46 pm on the date 2011-03-10. (again ignoring daylight-savings.)

Let's try to format that moment in time with a UTC notation:

Using the International Time Standard (ISO 8601) we would mark the earth-quake at 2011-03-11T05:46:01+00:00
That's at UTC 0, or what the military call "Zulu" time.

To adjust to Japan local time we need to use the Japan UTC offset of +09:00, and we get 2011-03-11T14:46:01+09:00
Notice all we did was add the 9 hours to the clock, and add that to the final offset notation.

To adjust to Pacific local time we need to use the UTC offset of -08:00, and we get 2011-03-10T21:46:01-08:00 Here we subtracted 8 hours from the clock, and added that to the final offset notation.
Since 8 hours subtracted from 5 gives a negative number, the date rolled backwards by one day!

Remember we had UTC 5am with a -8 hour offset (5 - 8 = -3) so we take 24 hours of the day, and add (-3) and we get 21, which on a 12 hour clock = 9pm. So when the earthquake hit Japan it was 2:46pm on the 11th local time. But for me , in Seattle, that moment was was 9:46pm on the 10th!

Head spinning?
Time to re-visit Tom Lehrer: "New Math"