Reputation: 127
Banging my head against the wall on this issue.
I receive a text string to my web service which is generated with json, for example:
"2014-09-19T17:00:00.000Z"
When i assign this to my database in entity framework, it changes it to 20:00 instead of 17:00. So i specify that it is UTC date by
DateTime.SpecifyKind("2014-09-19T17:00:00.000Z", DateTimeKind.UTC)
But this returns 20:00 as well! I could fix this by removing the Z but that is a dirty workaround as could be receiving time zones instead of Z. Is there way of setting telling vb to ignore the timezone and just save it as 17:00?
Upvotes: 2
Views: 1147
Reputation: 127
Thanks to Pawel for the hint. To help anyone else with this problem, please see the code below:
New DateTimeOffset("2014-09-19T17:00:00.000Z").ToUniversalTime
Upvotes: 1