Skip to main content

Date Time Persian

Project description

Date Time Persian

This library helps you to convert the Gregorian date to Iranian date and the Iranian date to Gregorian date.
You can also get the current time along with the date.

This library is supported by Sarzemin Danesh team.

You can contact us by sending an email or following our official page on Instagram:

Email : info@Lssc.ir

Instagram : @sarzamin.danesh


How it works?

Use the following command to install this library

pip install DateTimePersian

Use :

Display the current date and time.
The output is a string.

from DateTimePersian import DateTimePersian
get_date = DateTimePersian()
print(get_date)

_________ output _________
1401/9/5  15:09:48

Only show the current date.
The output is a string.

from DateTimePersian import DateTimePersian
get_date = DateTimePersian(TIME=False)
print(get_date)

_________ output _________
1401/9/5

Only show the current time.
The output is a string.

from DateTimePersian import DateTimePersian
get_date = DateTimePersian(DATE=False)
print(get_date)

_________ output _________
15:09:48

Command today() :

The desired function displays the current date in numeric and text formats. Two settings named date and type are defined for it.

Date = “fa” / “en”

Type = int / str

Ex : Default

from DateTimePersian import DateTimePersian
get_date = DateTimePersian()
print(get_date.today())

_________ output _________
1401/9/5

Ex : Type = str

from DateTimePersian import DateTimePersian
get_date = DateTimePersian()
print(get_date.today(Type = str))

_________ output _________
1401 آذر 5

Ex : Date = “en”

from DateTimePersian import DateTimePersian
get_date = DateTimePersian()
print(get_date.today(Date = "en"))

_________ output _________
2022/11/26

Ex: Date = “en” and Type = str

from DateTimePersian import DateTimePersian
get_date = DateTimePersian()
print(get_date.today(Date = "en", Type = str))

_________ output _________
2022 Nov 26

Other commands:

value command type output
Year getYear() object int
Month getMonth() object int
Day getDay() object int
Hour getHour() object str
Minutes getMin() object str
Seconds getSec() object str
leap year lYear(year) static int

Example Leap Year :

from DateTimePersian import DateTimePersian

print(DateTimePersian.lYear(1401))

_________ output _________
350

Example Convert Gregorian date to Iranian date :

from DateTimePersian import DateTimePersian
get_date = DateTimePersian()
print(get_date.C_EtoP(2022, 11, 26))

_________ output _________
1401/9/5

Example Convert Iranian date to Gregorian date :

from DateTimePersian import DateTimePersian
get_date = DateTimePersian()
print(get_date.C_EtoP(1401, 9, 5))

_________ output _________
2022/11/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

DateTimePersian-1.0.6.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

DateTimePersian-1.0.6-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file DateTimePersian-1.0.6.tar.gz.

File metadata

  • Download URL: DateTimePersian-1.0.6.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for DateTimePersian-1.0.6.tar.gz
Algorithm Hash digest
SHA256 fcf8eb6ebabec6813ba8173304b9738515fb2d1083252f5a27741bc796ec021a
MD5 9098f7446bd675fb2b98e60681e3d3e4
BLAKE2b-256 b5c5499bda021168b094fdfd00075b1b6bfc541772f5b99d79097ac59c655af3

See more details on using hashes here.

File details

Details for the file DateTimePersian-1.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for DateTimePersian-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a738974830c563228b59c9b1322b14d803b282f437695bc9e9f0474727607948
MD5 7443ffe618ab72a10a989c89c6c0d25d
BLAKE2b-256 651d9ed1ee2baad7104ecb9797dc4789d218ae965f1885e9ceebd5d3e97595ef

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