Reputation: 3061
Is there a way in T-SQL to Convert GMT To Central Time that compensates for Daylight Saving.
It seems that SWITCHOFFSET
only accepts a string in the format [+|-]TZH:TZM
or a signed integer (of minutes) that represents the time zone offset, and is assumed to be daylight-saving aware and adjusted.
Upvotes: 1
Views: 1900
Reputation: 7314
It's not easy to do, there are big issues relating to timezone conversion. I.e. what happens if you want to convert a date from last August, you'd need to know if DST was applicable when the time was recorded.
This is fixed in the latest version by using the datetimeoffset type. This records the UTC time plus the offset in force at when the datetime was recorded. This makes it much easier to work with timezones.
Here's a link The death of datetime
Upvotes: 1