What’s the significance of Nov 18th 1883 to software development in the US?

On November 18th 1883, the US adopted standardized time zones across the US. From a software development point of view, this means there is an interesting shift in the time zone offsets at this point in time – for example, after this date, Pacific Time is GMT-8, whereas before this date, Pacific time was GMT-7:52:58 (approx).

This becomes more interesting when dealing with Date apis that respect this date or not. For example, JodaTime does, but java.util.Date does not. When persisting dates to a database table via JDBC, JDBC does not know about the JodaTime types, it only knows about Types.DATE and Types.TIMESTAMP. Therefore this is there it starts to get wierd.

If you go DateTime -> Date -> Table, and then Table -> Date -> DateTime – you’re all good.

If you directly populate dates in the tables e.g. from scripts of other systems prior to 1883 though, JodaTime puts it’s offset on these dates when you retrieve them back out and you end up with dates and times that are off by 7mins 2 secs (approx).

An interesting issue that’s worth knowing about if you’re dealing with dates in the past.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.