I am receiving the following string from an api:
{ "CallTime" : "2018-02-23T16:00:01.806Z" }
In my database, I want to store all date/times in zulu time. To accomplish this, I am using DateTime.Parse
to convert this string into a DateTime
object. Then, I use the ToUniversalTime()
to change the time into zulu time (and then I store that in the database).
However, I'm not sure if I am understanding the interpretation of time zones correctly. If I look at the results, this is what confuses me:
DateTime.Parse("2018-02-23T16:00:01.806Z") /* = 2/23/2018 10:00:01 AM */
DateTime.Parse("2018-02-23T16:00:01.806Z").ToUniversalTime() /* = 2/23/2018 4:00:01 PM */
Isn't the original string already in zulu time? I would think these two values should be the same. There is no indication of a time zone in the original string, so wouldn't the Parse
function assume zulu time automatically? Or, does Parse
use the local system timezone and use that to convert the string to an object?