LesterDove
LesterDove

Reputation: 3044

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?

Upvotes: 0

Views: 88

Answers (2)

Hogan
Hogan

Reputation: 70513

The +8 refers to the offset from GMT so you must be -1 thus you get it in your time zone.

Upvotes: 1

Zong
Zong

Reputation: 6230

It appears +8 is the time zone associated with the time, and what you get is GMT.

Upvotes: 2

Related Questions