I was parsing a Reddit RSS feed and noticed that the time was in UTC. The server is located in the EST. The server is located in the timezone that is -5hrs from the UTC. How do I convert the UTC timecode to EST?
Note: I also read that UTC doesn't follow daylight savings time (DST), I'll figure out whether to adjust the hour difference later on by using date ranges.
Reddit item node in rss feed
<item>
<title>blah blah</title>
<link>http://blah.com</link>
<guid isPermaLink="true">http://www.reddit.com/r/blah/comments/blah</guid>
<pubDate>Sun, 16 Sep 2012 21:39:17 -0700</pubDate>
<description>blah description</description>
</item>
I came up with this so far:
DECLARE @d DATETIMEOFFSET;
SET @d = 'Sep 2012 21:39:17 -07:00'
DECLARE @off datetime
SET @off = SWITCHOFFSET(@d, '-05:00')
DECLARE @dates TABLE (
converteddate DATETIME
);
insert into @dates (converteddate)
Values (@off)
select * from @dates