Database time zone issue with SQL Server


US states falls under different time zones. There are states that doesn’t fall within a single time zone. MI has area in Central and Eastern time zones. Also in Indiana. Arizona doesn’t follow daylight savings, so it comes under mountain time for a part of the year and Pacific time for the rest.

We should store the time in UTC (Select GETUTCDATE())

SQL Server has datetimeoffset data type to store offset time which can be converted to any time zone , but you need to have the time difference information due to the above mentioned problem.

SWITCHOFFSET function will switch the timezone from datetimeoffset.

See this msdn blog : http://blogs.msdn.com/b/sqlprogrammability/archive/2008/03/18/using-time-zone-data-in-sql-server-2008.aspx

Advertisements

Comment please...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s