Following up with my last question, I'm curious how XmlSerializer
converts DateTime
.
I have a field in my XML file that looks like so:
<date>2011-01-10T00:00:00-05:00</date>
I'd like to deserialize this to a DateTime
.
This is EST by the looks of it. However, when I go to look at the result I get a datetime object that looks like 2011-01-09 21:00:00
. This seems like it's converting to my local time (PST).
- Why is this happening?
- How can I preserve the actual date being given in the XML during serialization? I'd prefer to keep UTC where possible during deserialization.
Thank you!
EDIT
I do not have control over the server nor the ability to change its format.