The three types of time

David Gilbertson
12 min readFeb 3, 2024

Handling dates and times in code can be tricky. Understanding that there are three types of time, that play by different rules, can help prevent bugs and ensure your code behaves as intended.

Before I describe these three types of time, let’s warm up with a riddle.

Alice and Bob were born at the exact same moment in time, in neighbouring towns somewhere in Florida. They met in school and immediately bonded over the fact that they had existed for the exact same number of seconds. Their love — naturally — flourished, and many years later, Bob took Alice out to a fancy dinner and proposed. She thought about it for a full 30 seconds before finally saying “sure”. The waiter overheard and wasted no time in suggesting some Champagne. “I’m afraid that’s against the rules”, said Alice, “I’m 21 but Bob is only 20”.

How could this be?

If the answer isn’t obvious now, it should be by the time you’ve finished this article.

Before going any further, a quick terminology note: throughout this article I will use the word ‘time’ to refer to the fully qualified time (year, month, day, hour, minute, etc) of an event. It’s weird that English doesn’t have an unambiguous term for this.

OK, let’s look at the three types of time.

1. Instants

Imagine you’re up in the International Space Station. You take a photo looking down over Europe as the morning sun spreads across the continent. At what time was this…

--

--