How to read ISO 8601
ISO 8601 is a format of expressing a date with timezone information. I used to get confused after looking at dates like “2014-10-07T16:11:24-07:00”. Ok so you can tell it is 7th October 2014 and 4:24 PM. The -07:00 tells us the timezone which is UTC - 7 hours- all good. On the surface it looked easy but it was confusing for me.
Is it saying 4:24 at UTC and timezone where record created was UTC -07:00 or is the time 4:24 at the timezone UTC - 07:00 hrs? This confused me for quite a while. Well, the answer is that it is the later. Here’s an example is ruby:
time = Time.now.iso8601 => "2014-10-07T16:11:24-07:00"
Means 4 11 PM in the timezone that is UTC - 7 hours
time = Time.now.utc.iso8601 => "2014-10-07T23:15:08Z"
The Z(for Zulu) at the end indicates the timezone is UTC and time is 9 11 PM in that timezone.
Continue reading →