How can I get the current time in GMT rather than local time?

Neil Pike

February 4, 2000

1 Min Read
ITPro Today logo

A. Use this code (courtesy of Microsoft PSS) :-

declare @deltaGMT int

exec master.dbo.xp_regread 
'HKEY_LOCAL_MACHINE',
'SYSTEMCurrentControlSetControlTimeZoneInformation',
'ActiveTimeBias', 
@DeltaGMT OUT

select getdate() as LocalTime, dateadd(minute, @deltaGMT, getdate() ) as GMT

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like