dst - Determine if daylight saving time is active? SQL Server -
i have table users, utc time offset, , if observe daylight saving time. there built in way correct user time?
right i'm doing this:
select case usedaylightsaving when 1 case datediff(hh,getutcdate(),getdate()) -- know server set mountan time , follows daylight saving time -- mdt = -6 -- mst = -7 when -6 dateadd(hh,timezoneoffset+1,getutcdate()) else dateadd(hh,timezoneoffset,getutcdate()) end else dateadd(hh,timezoneoffset,getutcdate()) end users
it works if server get's moved timezone or doesn't fallow daylight saving time i'm hosed.
Comments
Post a Comment