Shawn Wildermuth

Fun with .NET 3.5 - Part 1.1?

After digging into the TimeZoneInfo class, John Meyer pointed me a the new DateTimeOffset class and a MSDN article on choosing between DateTime, DateTimeOffset and TimeZoneInfo classes. I think I am more confused by the article than before.  Here are a couple of key bits of information:

  • DateTimeOffset is shoehorned into .NET 2.0 SP1, .NET 3.0 SP1 and .NET 3.5.  Not really a 3.5 requirement, but need to have patched Frameworks to use it.
  • DateTime and DateTimeOffset offer similiar but different functionality.  DateTime should be used for non-TimeZone specific use. DateTimeOffset can conatain the date/time information and the offset for that date.  Note that this is an offset, not what time zone it is in as they are different (but related) pieces of information
  • TimeZoneInfo, on the other hand, is all about specific time zones.

The article goes on to say two confusing statements:

Although the DateTimeOffset type includes most of the functionality of the DateTime type, it is not intended to replace the DateTime type in application development.


DateTimeOffset should be considered the default date and time type for application development.

I think I understand it, but it is very confusing.  In addition, its unclear how this relates to database data (I don't think there is a data type in SQL Server that encompasses offset and date/time information.)