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

php - How can I edit my code to echo the data of child's element where my search term was found in, in XMLReader? -

jQuery Ajax Render Fragments OR Whole Page -

java - Why is BlockingQueue.take() not releasing the thread? -