Skip to content

Repository files navigation

ICLib Java

Islamic Calculation Library (ICLib) contains calculations/algorithms needed specifically by muslims and people in muslim countries, such as salat (prayer) times, qibla direction, and Hijri conversion.

This library is written in Java and is a porting of the Python version. More information about the calculation method you should choose, etc, are available in the README file there.

Notes on Hijri conversion

Any Hijri conversion including Umm al-Qura is not used as reference for ibadah e.g. beginning of saum (fasting), Eid al-Fitr, and Eid al-Adha.

Usage example

Latitude and longitude are in degrees, positive values for north and east respectively, negative values for south and west respectively. More examples are available in example directory.

DateFormatformat = newSimpleDateFormat("HH:mm");
// optional: set timezone to make sure formatting is correct// format.setTimeZone(timeZone)Timestimes = newTimeCalculator()
// today
.date(newGregorianCalendar())
// latitude, longitude, altitude, timezone
.location(-6.38043079, 106.85337984, 0, +7)
// fajr and isha rule [, asr rule, time adjustment]
.method(AngleRule.EGYPT) // .method(AngleRule.EGYPT, false, TimeAdjustment.ZEROS)
.calculate();
for (Datetime : times) // as java.util.Dateprint(format.format(time));
// other stylesprint(times.getZuhr()); // as java.util.Dateprint(times.getTime(Times.ASR)); // as java.util.Dateprint(times.getHms(Times.MAGHRIB)); // simply as Hms (hour-minute-second)
// latitude and longitude of the userdoublelat = -6.169777778, lng = 106.8307333;
print(Qibla.findDirection(lat, lng)); // as double (in degrees)print(Qibla.findDirectionDms(lat, lng)); // as Dms (degree-minute-second)
/* By Java convention, month is 0-based and day-of-month is 1-based */// year, month, dayprint(UmmQura.toGregorian(1436, 0, 1)); // as java.util.GregorianCalendarprint(UmmQura.fromGregorian(newGregorianCalendar(2015, 0, 1))); // as HijriDate

We need your dua and support

Salam and have fun!

About

Islamic Calculation Library (ICLib) contains calculations for prayer (salat) times, qibla direction, and Hijri conversion

Topics

Resources

Stars

10 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages