Parasing a Date/Time string, to DateTime

  • Thread starter Thread starter Craig Lister
  • Start date Start date
C

Craig Lister

I am getting a date time in the following format:

2010-07-03T19:18:57+10:00

And I need to store that in a DateTiem property.

I am trying to use:
lastUpdate = DateTime.ParseExact(nodeRss.ChildNodes.InnerText,
"yyyy-MM-dd HH:mm:ss", null);

but failing. How should this be done?
 
I am getting a date time in the following format:

2010-07-03T19:18:57+10:00

And I need to store that in a DateTiem property.

I am trying to use:
lastUpdate = DateTime.ParseExact(nodeRss.ChildNodes.InnerText,
"yyyy-MM-dd HH:mm:ss", null);

but failing. How should this be done?


Try with:

"yyyy-MM-ddTHH:mm:sszzzz"

Arne
 
I am getting a date time in the following format:

2010-07-03T19:18:57+10:00

And I need to store that in a DateTiem property.

I am trying to use:
lastUpdate = DateTime.ParseExact(nodeRss.ChildNodes.InnerText,
"yyyy-MM-dd HH:mm:ss", null);

but failing. How should this be done?


Try with:

"yyyy-MM-ddTHH:mm:sszzzz"


Another approach would be:

DateTimeOffset.Parse(nodeRss.ChildNodes.InnerText, null,
DateTimeStyles.RoundtripKind)

Arne
 
Back
Top