How can I convert Persian date to Gregorian date using System.globalization.PersianCalendar?
Please note that I want to convert my Persian Date (e.g. today is 1391/04/07) and get the Gregorian Date result which will be 06/27/2012 in this case.
I’m counting seconds for an answer …
How can I convert Persian date to Gregorian date using System.globalization.PersianCalendar? Please note that
Share
It’s pretty simple actually:
When you call the
DateTimeconstructor and pass in aCalendar, it converts it for you – sodt.Yearwould be 2012 in this case. If you want to go the other way, you need to construct the appropriateDateTimethen useCalendar.GetYear(DateTime)etc.Short but complete program:
That prints 06/27/2012 00:00:00.