DateTime.ParseExact引发FormatException

Ami*_*tal 0 .net c# datetime

代码:

DateTime.ParseExact("2/2/2002", "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture)
Run Code Online (Sandbox Code Playgroud)

正在提高System.FormatException.

如果有人能告诉我我做错了什么,我真的很感激.

Joh*_*Woo 8

它应该是 d/M/yyyy

DateTime.ParseExact("2/2/2002", "d/M/yyyy", System.Globalization.CultureInfo.InvariantCulture)
Run Code Online (Sandbox Code Playgroud)

异常的原因是它转换了两个地方,dd但找到的字符串是2/.