Why can't DateTime.Parse parse UTC date

Dve picture Dve · Nov 18, 2009 · Viewed 116.9k times · Source

Why can't it parse this:

DateTime.Parse("Tue, 1 Jan 2008 00:00:00 UTC")

Answer

Simon P Stevens picture Simon P Stevens · Nov 18, 2009

It can't parse that string because "UTC" is not a valid time zone designator.

UTC time is denoted by adding a 'Z' to the end of the time string, so your parsing code should look like this:

DateTime.Parse("Tue, 1 Jan 2008 00:00:00Z");

From the Wikipedia article on ISO 8601

If the time is in UTC, add a 'Z' directly after the time without a space. 'Z' is the zone designator for the zero UTC offset. "09:30 UTC" is therefore represented as "09:30Z" or "0930Z". "14:45:15 UTC" would be "14:45:15Z" or "144515Z".

UTC time is also known as 'Zulu' time, since 'Zulu' is the NATO phonetic alphabet word for 'Z'.