Last active
April 5, 2019 08:58
-
-
Save adamhopkinson/d239937c56b29cc1da2e to your computer and use it in GitHub Desktop.
Converting a TSQL DateTimeOffset to UTC in Excel
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
/* | |
* if C2 contains a DateTimeOffset eg 2015-08-13 09:31:12.0000000 +01:00 | |
* parse the date and time out and add them together | |
* then subtract the hours offset (which - in Excel time storage is hours/24) | |
* note that this ignores the minute-part of an offset (eg Venezuela) | |
*/ | |
=DATE(LEFT($C2,4), MID($C2,6,2),MID($C2,9,2)) + TIME(MID($C2,12,2),MID($C2,15,2),MID($C2,18,2)) + (MID($C2,29,3)/24) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment