문제

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!

도움이 되었습니까?

해결책

With the ToUniversalTime method?

DateTimeOffset.Parse("2013-12-13T19:00:00+01:00").ToUniversalTime()
-> 2013-12-13 06:00:00 PM +00:00
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top