Code faster by representing datetimes as ISO8601 in UTC.
ISO8601 will save us from the drag of grokking datetime libraries and parsing errors. UTC will save us from dealing with timezones, and we all know how awful timezones can be.
How to use ISO8601
Format time as a string like the following for April 25, 2020, 10:28pm UTC
As a date
2020-04-25
As a datetime in UTC with second precision (fun fact: the Z stands for Zulu Time)
2020-04-25T22:28:00Z
As a datetime in UTC with millisecond precision
2020-04-25T22:28:00.000Z
Can we use ISO8601 for non-UTC?
2020-04-25T17:28:00-05:00
Yes, see the -05:00 instead of the Z? That means EST. But why would we, timezones are for people.
Okay, we’re done right? Sure with time, but if we use ISO8601 as a case study, we can learn how to design data formats that are fast to code.
Benefits of ISO8601
Fast for humans to read and write
When was 1587843046?
Yeah, I don’t know either. Humans are really slow at reading and writing datetimes represented as the number of secon…