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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -