/ Published in: SQL
![](/img/icon_sav.png?v3)
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
![RSS Feed for Comments RSS Icon](/images/rss.png?v3)