MahmoudS MahmoudS - 6 months ago 12x
Java Question

Can't get correct current islamic date

i am using joda time to get current islamic date in Saudi Arabia as in their website:

DateTime dtISO = new DateTime(2014, 1, 9, 0, 0, 0, 0);
DateTime dtIslamic = dtISO.withChronology(IslamicChronology.getInstance());

above prints the day less than the actual day, it prints that today is 7 but actual is 8.
please advise.


i even tried it with timezone as follows:

DateTimeZone SAUDI_ARABIA = DateTimeZone.forID("Asia/Riyadh");
DateTime dtISO = new DateTime(2014, 1, 9, 0, 0, 0, 0);
DateTime dtIslamic = dtISO.withChronology(IslamicChronology.getInstance(SAUDI_ARABIA));

but it gives same result.


First I have experimented with JodaTime's "leap-year-pattern". All four defined patterns yield the same result, namely the date "Hijrah 1435-03-07". Here my test code:

DateTime dtISO = new DateTime(2014, 1, 9, 0, 0, 0, 0);
DateTimeZone tzSAUDI_ARABIA = DateTimeZone.forID("Asia/Riyadh");
DateTime dtIslamic = 

According to the website the date should indeed be:

Thursday 8 Raby` al-awal 1435 A.H.

Or see:

We have to memorize here that Joda Time only supports islamic calendar based on an algorithmic calculation using a special leap year pattern. All in all I know of 8 such patterns. Joda Time defines four of them. What Joda Time does not support is the official calendar of Saudi-Arabia, namely Umalqura calendar which is a sighting based calendar. So as summary we can say: Using Joda Time is no option for Saudi-Arabia. What to do now?

One option is using as @PopoFibo has mentioned. The other option would be currently waiting for Java 8 which contains Umalqura calendar which is not necessary the same as the IBM version. In detail: While the IBM version is still based on calculations (either "astronomical" (not really) or "civil") the class java.time.chrono.HijrahDate uses a background lookup table with data given by saudi-arabian agency KACST. I would trust this version far more than the IBM version because for other dates IBM (here its library ICU4J) is not necessarily correct. So in Java 8 you could use:

HijrahDate hdate =, Month.JANUARY, 9));
System.out.println(hdate); // Output: "Hijrah-umalqura AH 1435-03-08"