Gnanu

Gnanu

  • 1.7k
  • 52
  • 9k

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)