Abdul Basith

Abdul Basith

  • NA
  • 22
  • 8.1k

String was not recognized as a valid DateTime.

Apr 1 2016 2:30 AM
Hi,
I'm taking a date value by using a date picker as a string value
 
  1. $("#Date").datepicker({  
  2.         changeMonth: true,  
  3.         changeYear: true,  
  4.         yearRange: "-100:+0",  
  5.         dateFormat: "dd/mm/yy"  
  6.     });  
 
 
but i'm getting this (String was not recognized as a valid DateTime.)error while debugging my code at this point
 
 
  1. PropDeedDate = Convert.ToDateTime(Exmod["Date"]);  
how can i solve this? 
I have tried
  1. PropDeedDate = DateTime.ParseExact(Exmod["Date"], "dd/MM/yyyy"null);  
But the error is still there

Answers (3)