Friday, July 08, 2005

DateTime is NOT UTC.

It is funny the things you learn from searches. Today I learned that System.DateTime is not based in UTC. In fact it is based in TAI, which is the real "atomic" time without leap-seconds. Now I realize most people don't know or care about the difference, but I have an obsession with dates, times and all things chronological. Here are a few of my favorite tidbits:

  • Developing Time-Oriented Database Applications in SQL by Richard T. Snodgrass is a wonderful book about doing proper SQL database designs and queries when the chronology of data points, the posting of them, or the subsequent view "in time" of data is important. This area is extremely difficult to get right consistently and this book walks you through the evolution of several real world systems to get it right as the needs are evolved. It is out of print, but you can download the book in PDF form here.
  • Why Daylight Savings Time is Non-intuitive Raymond Chen blog
  • Coding Best Practices Using DateTime in the .NET Framework Dan Rogers MSDN article. This is a great place to start, as it addresses most of the issues you will likely run into.
  • New DateTime Best Practices Article BCL Team Article. This is a very good summary of the issues you can run into and how to deal with them.
  • Representing Null DateTime values in code Scott Munro blog talks about how nulls in dates can be handled, lots of excellent links. I personally use the Null Object pattern with DateTime.MinValue representing start dates and DateTime.MaxValue representing end dates.
  • What are the New DateTime Features in Whidbey BCL Team blog gives the changes in .Net 2.0 for DateTime. I recommend all of Anthony Moore's postings as they are very informative and he owns System.DataTime.
  • More links to follow once CodeProject is back online.

    No comments: