Question

I found answer to hijri date in Islamic calendar but the code is very complex.

The Question


is there simple function to get it as DateTime type ?

Was it helpful?

Solution

Try using the Joda-Time API IslamicChronology. It's not part of the Android API, download the JAR and add it to your build path to use it in Android projects.

See Joda-Time documentation for Islamic calendar system.

Example code taken from that documentation:

// setup date object for midday on May Day 2004 (ISO year 2004)
DateTime dtISO = new DateTime(2004, 5, 1, 12, 0, 0, 0);

// find out what the same instant is using the Islamic Chronology
DateTime dtIslamic = dtISO.withChronology(IslamicChronology.getInstance());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top