简体   繁体   English

C#中的日期格式

[英]Date formatting in C#

I've got a datetime from an XML file of this format: 我从这种格式的XML文件中获得了日期时间:

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

And when I parse and convert it into a C# datetime using this code: 当我使用以下代码解析并将其转换为C#日期时间时:

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

I get 我懂了

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

Which I think is odd, since +8 ought to move you forward, not back. 我认为这很奇怪,因为+8应该使您前进,而不是后退。

Can anyone see what I'm missing? 谁能看到我所缺少的吗?

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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