[Last Call] Learn how to a build a cloud-first strategyRegister Now


Handling time zones and daylight savings time in .NET and SQL Server 08R2+

Posted on 2012-09-18
Medium Priority
Last Modified: 2012-10-09
Hi Experts,

     Is there a standard way to handle (record/display/report) time sensitive data that is generated accross time zones and daylight savings time?  We're in a .NET and SQL Server 08R2+ environment!  

I am seeing things about recording all time stamps in UTC time and then adding the TZoffset to it and using a lookup table (ISO-3166 country code) to account for the DST on top of the time zone calculation!  Is this the "correct" or "standard" way of doing it?

Also, I am seeing built in functionality in SQL to calculate local time from UTC

dateadd(minute, datepart(TZoffset, sysdatetimeoffset()), @InputUtcDateTime)

but is there anything built in to handle DST as well?

Question by:axnst2
LVL 96

Accepted Solution

Bob Learned earned 2000 total points
ID: 38413853
SQL Server 2008 has new elements for time zone adjustment, as described here:

Using time zone data in SQL Server 2008

Author Closing Comment

ID: 38477219
Thanks!  That's a big help!

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Screencast - Getting to Know the Pipeline

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question