String was not recognized as a valid DateTime “ format dd/MM/yyyy”

前端 未结 13 1141
一整个雨季
一整个雨季 2020-11-22 05:30

I am trying to convert my string formatted value to date type with format dd/MM/yyyy.

this.Text=\"22/11/2009\";

DateTime date = DateTime.Parse(         


        
13条回答
  •  抹茶落季
    2020-11-22 05:57

    Use DateTime.ParseExact.

    this.Text="22/11/2009";
    
    DateTime date = DateTime.ParseExact(this.Text, "dd/MM/yyyy", null);
    

提交回复
热议问题