none
the string was not recognized as a valid Datetime RRS feed

答案

  • 你好,

         你首先需要确保你的文本内容中不存在特殊字符,是正确的日期格式, 然后尝试下面的代码:  

    string dateString = @"20/05/2012";
    //The following code throws
    //FormatException: String was not recognized as a valid DateTime
    DateTime date = Convert.ToDateTime(dateString);

         你能参考这个链接找到解决方法:

          String was not recognized as a valid DateTime

          希望可以帮到你。


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    2014年2月21日 2:50
    版主