Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fikr4n/iclib-java
Islamic Calculation Library (ICLib) contains calculations for prayer (salat) times, qibla direction, and Hijri conversion
https://github.com/fikr4n/iclib-java
hijri islam java prayer qibla salat
Last synced: about 2 months ago
JSON representation
Islamic Calculation Library (ICLib) contains calculations for prayer (salat) times, qibla direction, and Hijri conversion
- Host: GitHub
- URL: https://github.com/fikr4n/iclib-java
- Owner: fikr4n
- License: apache-2.0
- Created: 2015-06-15T03:59:49.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-26T05:39:42.000Z (almost 8 years ago)
- Last Synced: 2024-08-01T20:35:16.905Z (5 months ago)
- Topics: hijri, islam, java, prayer, qibla, salat
- Language: Java
- Size: 85.9 KB
- Stars: 8
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-Islam - iclib-java
README
# 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](https://github.com/fikr4n/iclib-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.
```java
DateFormat format = new SimpleDateFormat("HH:mm");
// optional: set timezone to make sure formatting is correct
// format.setTimeZone(timeZone)
Times times = new TimeCalculator()
// today
.date(new GregorianCalendar())
// 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 (Date time : times) // as java.util.Date
print(format.format(time));
// other styles
print(times.getZuhr()); // as java.util.Date
print(times.getTime(Times.ASR)); // as java.util.Date
print(times.getHms(Times.MAGHRIB)); // simply as Hms (hour-minute-second)
``````java
// latitude and longitude of the user
double lat = -6.169777778, lng = 106.8307333;
print(Qibla.findDirection(lat, lng)); // as double (in degrees)
print(Qibla.findDirectionDms(lat, lng)); // as Dms (degree-minute-second)
``````java
/* By Java convention, month is 0-based and day-of-month is 1-based */
// year, month, day
print(UmmQura.toGregorian(1436, 0, 1)); // as java.util.GregorianCalendar
print(UmmQura.fromGregorian(new GregorianCalendar(2015, 0, 1))); // as HijriDate
```_We need your dua and support_
**Salam and have fun!**