I use Persian Date (Iranian Date Format or Jalali Calendar) in my program.
and when i use this:
string A = "1396/2/30";
string Test = String.Format("{0:yyyy/MM/dd}", Convert.ToDateTime(A));
I get the following error:
An exception of type 'System.FormatException' occurred in mscorlib.dll but was not handled in user code. Additional information: String was not recognized as a valid DateTime.
Create a fa-IR
CultureInfo
and then try usingDataTime.ParseExact()
instead ofConvert.ToDateTime()
.Update