Garima Bansal

Garima Bansal

  • 1k
  • 694
  • 41.4k

string was not recognized as a valid datetime

Feb 7 2024 7:26 AM

[FormatException: String was not recognized as a valid DateTime.]
System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +
5052855 System.Convert.ToDateTime(String value)

declaration global

 public string frdate { get; set; }
 public string todate { get; set; }

i want fix this error " String was not recognized as a valid DateTime."

DateTime frdate = Convert.ToDateTime(obj.frdate);
DateTime todate = Convert.ToDateTime(obj.todate);


Answers (8)