thendrickson
Programmer
We have a Server in the eastern time zone. users access this server through the web
We also have sites around the country in different time zones.
I need to store datetime values based on the local time of the user, not the server time. Basically I do not need to be 100% acurate, just the hour part. And I know the site location in every case. We populate time_zone when we set up a new site
The only problem I am having is accounting for locations where daylight savings time is not used (such as Indiana)
Sometimes I need to subtract 1 from the server time and sometimes I do not (for that site)
Currently, I get the server time and adjust the local hour using this very simple sp
So basically I need a way to determine when the server changes from standard time to daylight savings time.
Has anybody ever had to deal with something like this?
We also have sites around the country in different time zones.
I need to store datetime values based on the local time of the user, not the server time. Basically I do not need to be 100% acurate, just the hour part. And I know the site location in every case. We populate time_zone when we set up a new site
The only problem I am having is accounting for locations where daylight savings time is not used (such as Indiana)
Sometimes I need to subtract 1 from the server time and sometimes I do not (for that site)
Currently, I get the server time and adjust the local hour using this very simple sp
Code:
CREATE Procedure dbo.LocalTime @site_code VARCHAR (10), @localtime datetime Output
as
Declare @t as tinyint
--first see what the time zone adjustment is for the sight
SELECT @t = (Select time_zone from Site where sitecode = @site_code)
--if there is an value in the site table calculate it
if not @t is null
SET @LocalTime = DATEADD(hh,-@t,GetDate())
Else -- otherwise use the server time
set @localtime = GETDATE()
GO
So basically I need a way to determine when the server changes from standard time to daylight savings time.
Has anybody ever had to deal with something like this?