Akshaya arumugam

Akshaya arumugam

  • NA
  • 116
  • 38.8k

String was not recognized as a valid DateTime.why?

Dec 6 2017 11:23 AM
while i am trying to fetch datetime data from db it shows the error  String was not recognized as a valid DateTime.
 
 
code:
 
Model: 
 public DateTime? ReviewedDate{get;set;}
 
Controller: 
DateTime? ReviewedDate = null;
if (testordervm.ReviewedDate != DateTime.MinValue)
{
ReviewedDate = DateTime.Parse(dsobj.Tables[0].Rows[0]["ReviewedDate"].ToString());
}
else
{
ReviewedDate = null;
}
 

Answers (1)