This might sound silly, but bear with me. I’ve been working a lot with intervals and dates lately. One question that bothers me: is a day really 24 hours long? I’m interested by the answer both from a theoretical and from a practical point of view.
Let’s take today for example, the day started on 13 Dec 2012 00:00:00 and according to (all) date-time implementations it will end on 14 Dec 2012 00:00:00. This is correct and the difference between the two dates is a complete 24 hours.
The problem with this is that the end date is perceived as “tomorrow”. Most people thinking that a day starts on 00:00:00 and ends on 23:59:59.
So, is today a closed interval at the start, and opened at the end, like [start..end), with the end being very very close to 14 Dec 2012 00:00:00 (so not really a complete 24 hours)? Or is it actually closed at both ends with a full 24 hours between them?
This can only be resolved sensibly and unambiguously in the language of set membership, so that’s the tack I’ll choose here.
One day ends and the next begins at midnight. On a continuous-time basis, the set of moments that belong to one day consists of the half-open interval from midnight on that day (inclusive) to midnight of the next day (exclusive). On a discrete-time basis, the set of moments that belong to one day consist of those falling between midnight on that day (inclusive) and the moment that occurs at the smallest possible instant before the following midnight (inclusive).
In summary: a day is “as close as you can get” to 24 hours long. In the limiting case (continuous time), a day asymptotically approaches 24 hours in length. Obviously this discussion omits consideration of leap seconds and leap days.