简体   繁体   中英

Date formatting in C#

I've got a datetime from an XML file of this format:

<LastFetchTime>2011-03-25T00:09:09+08:00</LastFetchTime>

And when I parse and convert it into a C# datetime using this code:

lastAppliedDate = DateTime.Parse(xmlInput.Descendants("LastFetchTime").First().Value);

I get

{3/24/2011 12:09:09 PM}

Which I think is odd, since +8 ought to move you forward, not back.

Can anyone see what I'm missing?

似乎+8是与时间相关的时区,您得到的是GMT。

+8是与GMT的偏移量,因此您必须为-1,这样您才能在自己的时区中获取它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM