我有以下代码
public static void Main()
{
DateTime D = new DateTime();
D = DateTime.Now;
string s1 = D.ToString("ddMMMMyyyy");
Console.WriteLine(s1);
Console.WriteLine(DateTime.TryParseExact(s1, "ddMMMyyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out D));
Console.ReadKey();
}
Run Code Online (Sandbox Code Playgroud)
有人可以帮助我意识到我正在犯的明显错误.
我转换DateTime.Now为自定义格式的字符串并尝试将其转换回来,但TryParseExact返回false.