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
 General SQL Server Forums
 New to SQL Server Programming
 CONVERT TO GMT

Author  Topic 

rds207
Posting Yak Master

198 Posts

Posted - 2010-02-02 : 16:41:09
I have a date time field which is in PST :

2009-11-02 07:34:04.000(PST) - Finish_Time

and need to convert it to GMT

please help

Thank you

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-02-02 : 16:44:15
SELECT DATEADD(HOUR, {+ | -} n, '20091102 07:34:04')

where n is the time offset.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2010-02-02 : 16:49:29
[code]select
a.PST,
UDT_From_PST = dateadd(hour,8,a.PST)
from
( -- Test data
select PST = convert(datetime,'2009-11-02 07:34:04.000') union all
select PST = convert(datetime,'2009-11-02 21:34:04.000')
) a[/code]

Results:
[code]PST UDT_From_PST
----------------------- -----------------------
2009-11-02 07:34:04.000 2009-11-02 15:34:04.000
2009-11-02 21:34:04.000 2009-11-03 05:34:04.000

(2 row(s) affected)[/code]

CODO ERGO SUM
Go to Top of Page

rds207
Posting Yak Master

198 Posts

Posted - 2010-02-02 : 17:02:54
thank you :-)
Go to Top of Page
   

- Advertisement -