how do I fix the Hijri calendar being 1 day too early?
Today, my-time = 23 July, 2013 Tuesday
And the Islamic calendar time = 14 Ramadan, 1434 (according to this
My calendar is showing 15 Ramadan instead of 14. However I'm not sure whether it is my fault or the site's fault. Anyone 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 to 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 for value of months to be switch to 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 }
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With