Last active
December 13, 2015 21:19
-
-
Save fushnisoft/4976723 to your computer and use it in GitHub Desktop.
Convert SQL server DateTime stored in UTC to system DateTime
This file contains 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 @offset int | |
SET @offset = DATEDIFF(hh, GetDate(), GETUTCDATE()); | |
SELECT GetDate() AS 'System DateTime' | |
, GETUTCDATE() AS 'UTC DateTime' | |
, @offset AS 'OffSet' | |
, DateAdd(hh, @offset, GetDate()) AS 'System converted to UTC' | |
, DateAdd(hh, @offset*-1, GetUtcDate()) AS 'UTC Converted to System' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment