Time Conversion for Dummies
0August 13, 2012 by Mike Hillwig
My team is in three different locations. About half of us are here in Boston. The other half is on the other side of the planet in a timezone 9.5 hours away. And we have one guy working on the west coast.
Doing the time conversion between the left and right coasts of the United States is easy. Adding or subtracting three hours from a time is something I can do in my head. But I just can’t seem to wrap my head around that 9.5 hour thing. If it was a simple 9 hour calculation, I could get it. But that extra half hour seems to throw me off every time.
Being a SQL guy, I threw together this stupid little script to tell me what time it is for my entire team. It’s silly, but it works.
[SQL]declare @boston time
declare @seattle time
declare @india time
select @boston = ’08:00′
select @india = dateadd(minute, 570, @boston)
select @seattle = DATEADD (hh, -3, @boston)
select @india AS India
select @boston AS Boston
select @seattle AS Seattle[/SQL]
Category SQLServerPedia Syndication | Tags: