Friends in need
Random Quote
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
- Martin Fowler

The golden timestamp rules

If you, as a system developer or product owner, have to handle timestamps in your system, you have to think about a few things. Especially if you plan to show your users these timestamp values.

  1. If you decide to not use UTC everywhere, think again.
  2. If you still want to use other time zones than UTC, please, take a walk around the block, and then reconsider your decision, by reading about pros and cons with time zones.
  3. Okay, if you are sane, but still want to throw yourself into the time zone mud, you can at least consider the following:
    • Are you going to store all your timestamps in UTC, otherwise think again. (With all I mean exactly all, not most, not some, not the majority.)
    • Are you going to show your users any of your timestamps without explicit time zone information, think again. Or better yet, never do this.

If you use UTC everywhere your life will be a walk-in-the-park. The other paths may be dark and cumbersome and you have been warned.

First published by Anders Gustafson 2018-09-01