/ Published in: SQL

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
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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;
Comments
