elham deljooei

elham deljooei

  • NA
  • 84
  • 73.3k

How to convert PearsiandCalender to GregorianCalendar?

Oct 24 2013 4:07 AM
Hi friends,
I want to convert PersianCalendar to GregorianCalendar. This is my code but It couldn't work truly.

GregorianCalendar gCalender = new GregorianCalendar();
            string gcal =Convert.ToString( gCalender.GetYear(birthDate)+ "/"+ gCalender.GetMonth(birthDate)+ "/" + gCalender.GetDayOfMonth(birthDate));
            Console.WriteLine(gcal);
But i can convert GregorianCalendar to PersianCalendar. Like this:
onsole.WriteLine("Gregorian date change to Persian date");
            PersianCalendar pCalender = new PersianCalendar();
            string pcal = pCalender.GetYear(birthDate).ToString("0000") + "/" + pCalender.GetMonth(birthDate).ToString("00") + "/" + pCalender.GetDayOfMonth(birthDate).ToString("00");
            Console.WriteLine(pcal);

Answers (6)