Question

I have the following date provided via an XML file

2013-12-13T19:00:00+01:00

I would like to store it as DateTime within my database with ZERO UTC offset.

Unfortunatelly my webserver has the following TimeZone info which destroys my conversion logic...

-06:00:00
(UTC-06:00) Central Time (US & Canada)
Central Standard Time 

How can i accomplish this one? I am totally lost!

Was it helpful?

Solution

With the ToUniversalTime method?

DateTimeOffset.Parse("2013-12-13T19:00:00+01:00").ToUniversalTime()
-> 2013-12-13 06:00:00 PM +00:00
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top