September 17, 2013 at 8:44 am
Hi
I have to create offset to convert my EST Datetime columns to UTC to compare with Utc datetime columns.The server local time follows UTC timing .
I read few forums and few people suggested
@offset = DATEDIFF(HH,GETUTCDATE(),GETDATE()).
this one would not work on my server as my server localtime = utc time.So,I cannot obtain offset using the above method.Is there anyway you think I can convert my est datetime columns to utc considering daylight constraint.
Regards
S
September 17, 2013 at 10:02 am
Create a table that holds the DST start datetime and end datetime for each timezone you need to convert, and do a lookup against that table to determine if the offset should be 5 hours (not DST) or 4 hours (DST).
YearStartDateEndDate
20102010-03-14T02:002010-11-07T02:00
20112011-03-13T02:002011-11-06T02:00
20122012-03-11T02:002012-11-04T02:00
20132013-03-10T02:002013-11-03T02:00
20142014-03-09T02:002014-11-02T02:00
20152015-03-08T02:002015-11-01T02:00
20162016-03-13T02:002016-11-06T02:00
20172017-03-12T02:002017-11-05T02:00
20182018-03-11T02:002018-11-04T02:00
20192019-03-10T02:002019-11-03T02:00
Time Zone DST Info here:
September 17, 2013 at 12:59 pm
Thankyou.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply