Skip to main content

A Shamsi (Jalali) datetime class for NumPy integration

Project description

Shamsi DateTime

ShamsiDateTime is a Python package developed by Ali Razmjooei that provides a class for working with Shamsi (Jalali) dates. This package integrates seamlessly with NumPy, enabling you to handle Shamsi dates and convert them to and from Gregorian dates.

Overview

The Shamsi DateTime package allows you to:

  • Create and manipulate Shamsi (Jalali) dates.
  • Convert Shamsi dates to Gregorian dates and vice versa.
  • format dates in both Persian and English.
  • Easily integrate with NumPy for date manipulations and analysis.

Installation

To install the package, use pip:

pip install shamsi-datetime

Basic Usage

from shamsi_datetime import ShamsiDateTime
# if you are using with numpy
import numpy as np

# Create a Shamsi date with specific values
# میتونید ورودی رو خالی بزارید یا دلخواه وارد کنید (روز، ماه، سال)
shamsi_date = ShamsiDateTime(1403, 5, 6)
print(f"\nتاریخ شمسی دلخواه: {shamsi_date}")

# Create a Shamsi date with the current date
# تاریخ امروز
current_shamsi_date = ShamsiDateTime()
print(f"تاریخ امروز: {current_shamsi_date}")

# Convert to Gregorian (NumPy datetime64)
# تبدیل تاریخ شمسی به میلادی بر حسب تاریخ امروز یا تاریخ ورودی دلخواه
gregorian_date = shamsi_date.to_gregorian()
print(f"تاریخ میلادی برحسب تاریخ شمسی: {gregorian_date}")

# Convert back to Shamsi
# با استفاده از متد زیر میتونید تاریخ میلادی رو به شمسی تبدیل کنید
shamsi_converted_back = ShamsiDateTime.from_gregorian(gregorian_date)
print(f"تبدیل تاریخ میلادی به شمسی: {shamsi_converted_back}\n")

Features

  • ShamsiDateTime Class: Represents Shamsi dates with easy conversion to and from Gregorian dates.
  • Conversion Methods: Convert between Shamsi dates and Gregorian dates using NumPy's datetime64.
  • Integration with NumPy: Leverages NumPy for efficient date operations.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

If you would like to contribute to the development of ShamsiDateTime, please fork the repository and submit a pull request. For any issues or feature requests, please open an issue on the GitHub repository.

Contact

For any questions or feedback, you can reach out to the author:

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

shamsi_datetime-0.2.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

shamsi_datetime-0.2.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file shamsi_datetime-0.2.0.tar.gz.

File metadata

  • Download URL: shamsi_datetime-0.2.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for shamsi_datetime-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8e679914273b4ac62ed5c8ef1cabba669e347abf5e9bd8f7f38e7129e9a7c1c5
MD5 afd984178b1e15e20be0f6ec3f9139c6
BLAKE2b-256 24ee07ee71072c3cdc8d2273f3e4bb7ec496212b23c8bc806d582fdbccc4209e

See more details on using hashes here.

File details

Details for the file shamsi_datetime-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for shamsi_datetime-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5ebd08ffa205314a5b4d6785cefa936ca4e1086bcf3f63c2f34387bdce4c940
MD5 09b094f68f6c762549548e540bb13772
BLAKE2b-256 03a68db0e04b19236c8c6f402241df41e96b612c859a138e8ff2fdfe09a18ef7

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