I use the function below to convert Gregorian dates to Persian dates, but I\'ve been unable to write a function to do the reverse conversion. I want a function that converts
This method converts a string which represents a shamsi date to System.DateTime :
public DateTime milady(string shamsiDate)
{
DateTime dt = new DateTime();
PersianCalendar pc = new PersianCalendar();
int pYear = Convert.ToInt32(shamsiDate.Substring(0, 4));
int pMonth =Convert.ToInt32(shamsiDate.Substring(5, 2));
int pDay = Convert.ToInt32( shamsiDate.Substring(8));
dt = pc.ToDateTime(pYear, pMonth, pDay,0,0,0,0);
return dt;
}