Giter VIP home page Giter VIP logo

iclib-java's Introduction

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.

	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)
	// 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)
	/* 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!

iclib-java's People

Contributors

fikr4n avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.