Skip to main content

Python Hijri Ummalqura

Project description

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.

Thanks for Khalid Al-hussayen : https://pypi.python.org/pypi/umalqurra/0.2

Install:

sudo pip3 install ummalqura

Features:

  • Convert Gregorian to Hijri

  • Convert Hijri to Gregorian

  • give the arabic name of the hijri month

  • give the english name of the gregorian month

  • give the day name in Arabic and English

  • give the current day both in Hijri and Gregorian

Usage

#!/usr/bin/env python3

from ummalqura.hijri_date import HijriDate
from datetime import date


# create the object with Gregorian date
um = HijriDate(2017, 12, 26, gr=True)

# hijri month
print('hijri month: ', um.month)  # 4
# Hijri year
print('hijri year: ', um.year)  # 1439
# arabic day name
print('arabic day name: ', um.day_name)  # الثلاثاء
# english day name
print('english day name: ', um.day_name_en)  # Tuesday
# arabic hijri month name
print('arabic hijri month name: ', um.month_name)  # ربيع الثاني
# english gregorian month name
print('english gregorian month name: ', um.month_name_gr)  # December
# gregorian year
print('gregorian year: ', um.year_gr)  # 2017
# gregorian month
print('gregorian month: ', um.month_gr)  # 12
# gregorian day
print('gregorian day: ', um.day_gr)  # 26

# current hijri month
print('current_month: ', HijriDate.current_month())  # 4
# the gregorian date corresponding to the first day of the given hijri month/year
print('first day: ', HijriDate.month_start_date(4))  # 2017-12-19
print('first day: ', HijriDate.month_start_date(4, 1439))  # 2017-12-19
# the gregorian date corresponding to the last day of the given hijri month/year
print('last day: ', HijriDate.month_end_date(4))   # 2018-01-17
print('last day: ', HijriDate.month_end_date(4, 1439))   # 2018-01-17
# the hijri month for the given gregorian date
print('hijri month: ', HijriDate.hijri_month_from_date(date.today()))  # 4
# the hijri year for the given gregorian date
print('hijri year: ', HijriDate.hijri_year_from_date(date.today()))  # 1439
# convert the given gregorian date to hijri date
print('hijri date: ', HijriDate.get_hijri_date(date.today()))  # 1439-04-08
# convert the given hijri date to gregorian date
print('georing date: ', HijriDate.get_georing_date('1439-04-08'))  # 2017-12-26

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ummalqura-2.0.1.tar.gz (11.0 kB view details)

Uploaded Source

File details

Details for the file ummalqura-2.0.1.tar.gz.

File metadata

  • Download URL: ummalqura-2.0.1.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ummalqura-2.0.1.tar.gz
Algorithm Hash digest
SHA256 657ee9f4ee961a5f1381a2abb0c22801859fa6803533ccf6c888194e6b301d03
MD5 4c2a7f5e52034e450bbdebb68189dbd5
BLAKE2b-256 41fed44e0cd296392ec5ddedd0780f8d66e44eeeb61238e2a21b48e743259160

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page