且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从ISO 8601格式创建一个.NET日期时间

更新时间:2023-02-03 22:12:13

该解决方案使用了 DateTimeStyles的枚举,并且它也可以以Z。

This solution makes use of the DateTimeStyles enumeration, and it also works with Z.

DateTime d2= DateTime.Parse("2010-08-20T15:00:00Z",  null, System.Globalization.DateTimeStyles.RoundtripKind);

这将打印解决方案完美。

This prints the solution perfectly.