c# - Hijri calendar is 1 day too early. -
how fix hijri calendar being 1 day early?
today, my-time = 23 july, 2013 tuesday
, islamic calendar time = 14 ramadan, 1434 (according this
my calendar showing 15 ramadan instead of 14. i'm not sure whether fault or site's fault. can confirm today's ramadan date?
lblgreg.text = datetime.today.tostring("dd/mm/yyyy");
today's date:
datetime today = datetime.today;
conversion of gregorian calendar hibri:
cultureinfo hijri = cultureinfo.createspecificculture("ar-sa"); string datetoday_day = today.tostring("dd", hijri); string datetoday_month = today.tostring("mm", hijri); string datetoday_year = today.tostring("yyyy", hijri); int month_check = int.parse(datetoday_month);
switch statement value of months switch text-month:
switch (month_check) { case 01: { lbldate.text = datetoday_day + " muharram " + datetoday_year; break; } case 02: { lbldate.text = datetoday_day + " safar " + datetoday_year; break; } case 03: { lbldate.text = datetoday_day + " rabi al-awwal " + datetoday_year; break; } case 04: { lbldate.text = datetoday_day + " rabi al-akhar " + datetoday_year; break; } case 05: { lbldate.text = datetoday_day + " jumada al-awwal " + datetoday_year; break; } case 06: { lbldate.text = datetoday_day + " jumada al-akhirah " + datetoday_year; break; } case 07: { lbldate.text = datetoday_day + " rajab " + datetoday_year; break; } case 08: { lbldate.text = datetoday_day + " shaban " + datetoday_year; break; } case 09: { lbldate.text = datetoday_day + " ramadan " + datetoday_year; break; } case 10: { lbldate.text = datetoday_day + " shawwal " + datetoday_year; break; } case 11: { lbldate.text = datetoday_day + " dhul-qadah " + datetoday_year; break; } case 12: { lbldate.text = datetoday_day + " dhul-hijjah " + datetoday_year; break; } }
use umalquracalendar
instead.
var umalquracalendar = new umalquracalendar(); cultureinfo hijri = new cultureinfo("ar-sa") { datetimeformat = { calendar = umalquracalendar } };
Comments
Post a Comment