Friday, November 29, 2013

DateTimeOffset does not help you with Daylight Savings Time!

This one is often a source of confusion. DateTimeOffset data type has been introduced to SQL Server but it is only a try (at best) to help out with TimeZone issues. It only contains the (numerical) offset from UTC but, as many know, that offset changes throughout the year. This is known by Daylight Savings Time (DST) and is in effect at different times at different regions in different years. The whole concept is getting obsolete as of late but it is still there and we have to live with it.

Check Jon Skeet's answer below and also have a look at NodaTime library that has a better implementation for working with TimeZones, offsets, and daylight savings.

c# - How does DateTimeOffset deal with daylight saving time? - Stack Overflow

No comments: