This isn't a productivity talk. It's a survey of some idiosyncrasies related to persisting date/time values to a database.
How to Save TimeJoel Clermont @jclermont
View Slide
Productivity
ISO8601
Date time values are tricky• Date math• Leap years/seconds• Daylight Saving Time• Time Zones• Many more . . .https://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time
Approach 1Everything is local
Everything is local2018-11-06T09:05:23
Everything is localPro: super easy, no thought/effortCon: What if you have users in a different time zone?
Approach 2Local plus time zone offset
Local plus offset2018-11-06T09:05:23-06:00
Local plus offsetPro: can convert to other time zonesCon: Not consistent, lots of tz values
Approach 3Always store UTC
Always store UTC2018-11-06T15:05:23Z2018-11-06T15:05:23+00:00
Always store UTCPro: able to convert, consistentCon: ?? Is there an unsolved problem?
ProblemPoliticians can break your code
What if the time zonerules change?
https://www.timeanddate.com/news/time/
Approach 4Future dates as wall time + tz name
Future as wall + tz name2019-11-06T12:00:00America/Sao_Paulo
Future as wall + tz namePro: TZ rules can changeCon: New time zones? God help you
Questions?@jclermont
Thank you!@jclermont