Python Umalqurra Calender is an API that will give you the ability to convert Gregorian to Hijri and hijri to Gregorian. It will give you the day name in arabic and english, and the month name in Hijri arabic and Gregorian.
The Hijri algorithm code has been translatde from javascript to python.
The javascript was developed by Suhail Alkowaileet: https://github.com/xsoh/Hijri.js/blob/master/Hijri.js
also this code for more understanding: https://github.com/kbwood/calendars/blob/master/src/js/jquery.calendars.ummalqura.js
The project is based on : https://github.com/tytkal/python-hijiri-ummalqura
Compatibility: Compatible with Python 2.x and 3.x
This is an improved version PEP8 compliant, bugs fixed and ready to use.
You will need the following software properly installed on your computer.
Clone the repo and run :
git clone https://github.com/QuantumPrayerTimes/hijricalendar.git
cd hijricalendar
python setup.py install
Example of usage :
import datetime
from hijricalendar.hijri_date_wrap import HijriDateWrapper
today = datetime.date.today()
# Create a gregorian date
hdw = HijriDateWrapper(date=today, gregorian=True)
print(hdw)
# Get the associated Hijri date
hdw.get_hijri_date()
hdw.get_gregorian_date()
# Set the date to another one
hdw.set_date_from_gr(2016, 10, 15)
hdw.get_hijri_date()
hdw.get_gregorian_date()
# Set a Hijri date
hdw.set_date_from_hr(1437, 10, 15)
hdw.get_hijri_date()
hdw.get_gregorian_date()
Homepage: https://github.com/QuantumPrayerTimes/hijricalendar
Source:
If you have any issues or improvements, do not hesitate to create an issue or submit a pull request.