Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Convert time from GMT to EST format

Author  Topic 

Cooldmitriy
Starting Member

5 Posts

Posted - 2006-10-12 : 15:03:32

Is there a function to converts time from GMT format to EST ?

Thank you

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2006-10-12 : 15:13:11
One tablespoon DATEADD(), 1/4 cup of monkey brain ... then wave a rubber chicken over the mixture ...

Jay White
Go to Top of Page

Cooldmitriy
Starting Member

5 Posts

Posted - 2006-10-12 : 15:53:24
It will not work smarta$$. GMT is 4 hrs behind, but Europe goes back 1 hr(standard time), one week before the US.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-10-12 : 16:18:21
quote:
Originally posted by Cooldmitriy

It will not work smarta$$. GMT is 4 hrs behind, but Europe goes back 1 hr(standard time), one week before the US.

Write a function for that 4 hour difference, taken into account for the dates you have knowledge of.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-10-12 : 16:18:48
EST (Eastern Standard Time) is always UTC (GMT) minus 5 hours.
EDT (Eastern Daylight Time) is always UTC (GMT) minus 4 hours.

Is it possible that your real question (as opposed to the one you asked) is how to determine which to use?

select
[Eastern Standard Time] = dateadd(hour,-5,MyUTCTime),
[Eastern Daylight Time] = dateadd(hour,-4,MyUTCTime),
MyUTCTime
from
( Select MyUTCTime = getutcdate() ) a



Eastern Standard Time Eastern Daylight Time MyUTCTime
------------------------ ------------------------ ------------------------
2006-10-12 15:13:50.903 2006-10-12 16:13:50.903 2006-10-12 20:13:50.903

(1 row(s) affected)


CODO ERGO SUM
Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2006-10-12 : 17:35:51
quote:
Originally posted by Cooldmitriy

It will not work smarta$$. GMT is 4 hrs behind, but Europe goes back 1 hr(standard time), one week before the US.



Holy crap! That's awesome!

Jay White
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-10-12 : 18:58:28
quote:
Originally posted by Page47

quote:
Originally posted by Cooldmitriy

It will not work smarta$$. GMT is 4 hrs behind, but Europe goes back 1 hr(standard time), one week before the US.



Holy crap! That's awesome!

Jay White



Guess he told you.

I loved the way he backed it up with incorrect ("GMT is 4 hrs behind") and irrelevant information ("Europe goes back 1 hr(standard time), one week before the US").





CODO ERGO SUM
Go to Top of Page
   

- Advertisement -