Gnanu

Gnanu

  • 1.8k
  • 20
  • 577

string was not recognized as a valid datetime

Aug 23 2019 8:08 AM
I'm trying to convert date format but its exception, string was not in valid date time.
 
string FROM = DtpFrom.Value.ToString();
DateTime mfromdt = DateTime.ParseExact(FROM, "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture);
FROM = mfromdt.ToString();
 
 
this is my code, i'm getting exception at DateTime mfromdt and getting 
DtpFrom.value="8/23/2019 6:36:46 PM"(in MM/dd/yyyy) format.
 
 
 
Thanks in advance! 

Answers (6)