DateTime.ParseExact FormatException String was not recognized as a valid DateTime

后端 未结 2 1773
不知归路
不知归路 2021-01-12 01:39

I\'m completely stumped on this one. As far as I can see the documentation and other posts on SO I\'ve read say this should work. I must be missing something silly, but I ju

2条回答
  •  温柔的废话
    2021-01-12 02:01

    Does this work

     string myDate = "30-12-1899 07:50:00:AM";
    DateTime dt1 = DateTime.ParseExact(myDate, "dd-MM-yyyy hh:mm:ss:tt", 
                                               CultureInfo.InvariantCulture)
    

提交回复
热议问题