SQL Interview Questions

SQL SERVER – Get Current TimeZone Name in SQL Server

SQL SERVER – Get Current TimeZone Name in SQL Server

Use below sql script to get timezone of sql server :

DECLARE @TimeZone VARCHAR(50)

EXEC MASTER.dbo.xp_regread ‘HKEY_LOCAL_MACHINE’,’SYSTEMCurrentControlSetControlTimeZoneInformation’,
‘TimeZoneKeyName’,@TimeZone OUT

SELECT @TimeZone

Leave a Reply