How to convert between calendars? Here is what I have:
UmAlQuraCalendar hijri = new UmAlQuraCalendar();
GregorianCalendar cal = new GregorianCalendar();
DateTime hijriDate = new DateTime(1434, 11, 23, hijri);
DateTime gregorianDate = ...; //
I need a gregorianDate
that corresponds to the hijriDate
.
It seems that the Date saved in DateTime
is always in the current calendar. So if the current calendar is Gregorian hijriDate
is already in Gregorian.
var hijriDate = new DateTime(1434, 11, 23, hijri);
//Console writeline will show 2013-09-29 00:00:00
If your current calendar is UmAlQuraCalendar
you should be able to extract a Gregorian date using:
var hijri = new UmAlQuraCalendar();
var cal = new GregorianCalendar();
var hijriDate = new DateTime(1434, 11, 23, hijri);
var y = cal.GetYear(hijriDate),
var m = cal.GetMonth(hijriDate),
var d = cal.GetDayOfMonth(hijriDate)