Skip to main content

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

Metadata

Release files for persian-date 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for persian-date 1.0.5
File Size Uploaded Provenance Actions
persian_date-1.0.5.tar.gz 2.6 kB Without provenance Details for persian_date-1.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for persian-date 1.0.5
File Interpreter ABI Platform Actions
persian_date-1.0.5-py3-none-any.whl Python 3 none any Details for persian_date-1.0.5-py3-none-any.whl

Total release size: 5.4 kB

Release files / persian_date-1.0.5.tar.gz

Download URL persian_date-1.0.5.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c3c1bfc7ba350d5231b959b9064700445d00a9c3af9dbca8eaf2677c80763e6a
BLAKE2b-256 checksum
How to use checksums
7058a885c740013267777b9a732002b793655822f75935f40a5a85eef0c5a4dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.24

Release files / persian_date-1.0.5-py3-none-any.whl

Download URL persian_date-1.0.5-py3-none-any.whl
Size 2.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b427e143c365c0fbaf5cc3b5227ef46de9e46af7b12cf42c5825e52b3651e5f2
BLAKE2b-256 checksum
How to use checksums
96a522546ccbb470d2233f898974594b5f710435629f96c478b783b9671c5579
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.24

Security for persian-date 1.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page