Created
May 27, 2016 04:15
-
-
Save wholroyd/61df669833aed451a3386b478bcc322c to your computer and use it in GitHub Desktop.
Keep the timezone as an offset and not an adjustment
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
var test = "2016-11-21T23:00:00-05:00"; | |
var temp1 = DateTime.Parse(test); | |
temp1.Dump(); // Returns: 11/22/2016 4:00:00 AM | |
var temp2 = DateTimeOffset.Parse(test); | |
temp2.Dump(); // Returns: 11/21/2016 11:00:00 PM -05:00 | |
var temp3 = DateTimeOffset.Parse(test).DateTime; | |
temp3.Dump(); // Returns: 11/21/2016 11:00:00 PM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment