Skip to main content

Get current date in Persian, Gregorian, or Hijri calendars

Project description

PersianDate

PersianDate is a lightweight Python library that provides the current date in three different calendar systems:

  • Gregorian
  • Solar Hijri (Persian)
  • Hijri (Islamic)

Unlike most libraries, PersianDate does not rely on any system clock or time server.
Instead, it automatically scrapes the official Time.ir website to extract the current date directly from its HTML content.
This makes it accurate and timezone-independent as long as an internet connection is available.


🚀 Installation

You can install the package using pip:

pip install persian-date

📚 Classes

The library provides three main classes, one for each calendar type:

Class Description Methods
SolarDate Persian (Solar Hijri) date show_numeral(), show_char()
GregorianDate Gregorian date show_numeral(), show_char()
HijriDate Islamic (Hijri) date show_numeral(), show_char()

Methods:

  • show_numeral() → Returns the date in numeric format (e.g., 1404-08-13)
  • show_char() → Returns the date in textual format (e.g., Tuesday - 2025 04 November)

💡 Examples

Example 1 – Numeric date output:

from persian_date import GregorianDate

today = GregorianDate.show_numeral()
print(today)

Output:

2025-11-04

Example 2 – Textual date output:

from persian_date import GregorianDate

today = GregorianDate.show_char()
print(today)

Output:

Tuesday - 2025 04 November

🌐 Notes

Internet connection is required because the library fetches and parses live data from Time.ir.

Ideal for Persian or multilingual date applications.


Author: Bardia Nikbakhsh Email: Bardianikbakhsh@gmail.com GitHub: https://github.com/bardianz/PersianDate-python-package

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

persian_date-1.0.5.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

persian_date-1.0.5-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file persian_date-1.0.5.tar.gz.

File metadata

  • Download URL: persian_date-1.0.5.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for persian_date-1.0.5.tar.gz
Algorithm Hash digest
SHA256 c3c1bfc7ba350d5231b959b9064700445d00a9c3af9dbca8eaf2677c80763e6a
MD5 0512695e5c7e29491784ab1735ab7589
BLAKE2b-256 7058a885c740013267777b9a732002b793655822f75935f40a5a85eef0c5a4dc

See more details on using hashes here.

File details

Details for the file persian_date-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: persian_date-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for persian_date-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b427e143c365c0fbaf5cc3b5227ef46de9e46af7b12cf42c5825e52b3651e5f2
MD5 c54d36b732fbe6e1d0eb9e494407a0a3
BLAKE2b-256 96a522546ccbb470d2233f898974594b5f710435629f96c478b783b9671c5579

See more details on using hashes here.

Supported by

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