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

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

declare @deltaGMT int

exec master.dbo.xp_regread 

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

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.