Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse Date Time from US Time zone to Datetime.

How to parse below date time string?

2014-01-17T09:59:24.000Z

I tried below code but its, not working.

DateTime.ParseExact("2014-01-17T09:59:24.000Z", "ddd MMM dd HH:mm:ss %zzzz yyyy", CultureInfo.InvariantCulture);
like image 290
Pramod Avatar asked Mar 11 '26 22:03

Pramod


1 Answers

With a string like "2014-01-17T09:59:24.000Z"

You can just use DateTime.Parse("2014-01-17T09:59:24.000Z")

From The Documentation:

The string to be parsed can take any of the following forms:

A string that includes time zone information and conforms to ISO 8601. In the following examples, the first string designates Coordinated Universal Time (UTC), and the second string designates the time in a time zone that's seven hours earlier than UTC:

2008-11-01T19:35:00.0000000Z 

2008-11-01T19:35:00.0000000-07:00
like image 102
Matt Wilko Avatar answered Mar 14 '26 12:03

Matt Wilko