Return to Snippet

Revision: 72012
at April 12, 2017 13:47 by sankarwaits


Initial Code
SELECT
  SYSDATETIME() AS curdatetime,
  DATENAME(TZoffset, SYSDATETIMEOFFSET()) AS curtzoffsetstr,
  DATEPART(TZoffset, SYSDATETIMEOFFSET()) AS curtzoffsetint;

  DECLARE @tzname AS sysname;

EXEC master.dbo.xp_regread
  'HKEY_LOCAL_MACHINE',
  'SYSTEM\CurrentControlSet\Control\TimeZoneInformation',
  'TimeZoneKeyName',
  @tzname OUTPUT;

SELECT @tzname;

Initial URL

                                

Initial Description
The below code has 2 snippets. to find the time difference from the current zone and the other is to find the timezone of the server

Initial Title
SQL To get the Server Timezone.

Initial Tags
sql

Initial Language
SQL