9.2. The ISO Half-Open Interval Model

The display formats for temporal data are defined by the ISO-8601 Standard. The display formats are important, of course, but even more important is the underlying model of durations. They are considered to be half-open intervals. That means that we have an exact point in time when an event starts, but we can only approach the end of it as a limit. To make that clearer, consider the date 2006-12-31 as a shorthand for the interval (2006-12-31 00:00:00 through 2006-12-31 23:59:59.999...). There is no such time as “2006-12-31 24:00:00” in this model; technically, the hour does not exist, and you meant to say “2007:01-01 00:00:00” instead.

DB2 and other SQL products allow a timestamp whose time part is 24:00:00.000000. ...

Get Joe Celko's Thinking in Sets: Auxiliary, Temporal, and Virtual Tables in SQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.