Last active
August 23, 2017 18:53
-
-
Save uuklanger/7c114e70317413e0d0057888348c0a8a to your computer and use it in GitHub Desktop.
Determine the timezone of the SQL Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @TimeZone VARCHAR(50) | |
EXEC MASTER.dbo.xp_regread 'HKEY_LOCAL_MACHINE', | |
'SYSTEM\CurrentControlSet\Control\TimeZoneInformation', | |
'TimeZoneKeyName',@TimeZone OUT | |
SELECT @TimeZone | |
-- OR this snippet but I am not sure I trust it yet.... | |
DECLARE @TZ SMALLINT | |
SELECT @TZ=DATEPART(TZ, SYSDATETIMEOFFSET()) | |
SELECT CAST(@TZ/60 AS VARCHAR(5))+ ':' +Cast(ABS(@TZ)%60 AS VARCHAR(5)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment