Amaresh K

Amaresh K

  • NA
  • 101
  • 26.4k

String was not recognized as a valid DateTime

Jun 26 2018 11:22 PM

Server Error in '/' Application.

String was not recognized as a valid DateTime.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: String was not recognized as a valid DateTime.

Source Error:

Line 395:FromDate = Convert.ToDateTime(datepicker1.Text).ToString("MM/dd/yyyy");
Line 396:ToDate = Convert.ToDateTime(datepicker2.Text).ToString("MM/dd/yyyy"); 
Line 397:Session["FromDate"] = Convert.ToDateTime(datepicker1.Text).ToString("MM/dd/yyyy");
Line 398:Session["ToDate"] = Convert.ToDateTime(datepicker2.Text).ToString("MM/dd/yyyy");

Answers (3)