I am reading the date from an XML file and parsing it in the desired format. It is I who add the day to the date, and I cannot understand why.
: 2014-02-12T15: 21: 19-08: 00 withdrawal: February 13, 2014 01:21
Here is my date parsing code:
string date = DateTime.Parse(row["CountDate"].ToString()).ToString("dd MMM yyyy HH:mm");
Any help would be greatly appreciated.
The reason is that the time zone information is used to set the time to the local time zone.
If you remove the suffix "-08: 00", you will find that the time will not be changed. However, you need to know if time zone information is important before ignoring it!
, , / UTC 8- , , (Parse ).
Parse
/ UTC, .
DateTime.ParseExact("yyyy-MM-ddTHH:mm:ss", row["CountDate"], CultureInfo.InvariantCulture);