为什么不能DateTime.Parse解析UTC的日期
为什么无法解析:
DateTime.Parse("Tue, 1 Jan 2008 00:00:00 UTC")
无法解析该字符串,因为UTC不是有效的时区指示符。
It can't parse that string because "UTC" is not a valid time zone designator.
UTC时间通过在时间字符串末尾添加Z ,所以你的解析代码应该如下所示:
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");
如果时间是UTC,添加一个'Z直接在
之后没有
的空间。 'Z'是零时UTC偏移量的
的区域指示符。 09:30 UTC是
,因此表示为09:30Z或
0930Z。 14:45:15 UTC将是
14:45:15Z或144515Z。
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时间也被称为祖鲁时间,
,因为祖鲁是Z的北约语音
字母表。
UTC time is also known as 'Zulu' time, since 'Zulu' is the NATO phonetic alphabet word for 'Z'.