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
name day Persian getNameDayP() object str
name day Gregorian getNameDayE(type = 'L' / 'S') object str
name month Persian getNameMonthP() object str
name month Gregorian getNameMonthE(type = 'en' / 'fa') object str

Example Leap Year :

from DateTimePersian import DateTimePersian

print(DateTimePersian.today(1401))

_________ output _________
350

Example name day Persian :

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

_________ output _________
جمعه

Example name day Gregorian with type = 'L' :

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

_________ output _________
Friday

Example name day Gregorian with type = 'S' :

from DateTimePersian import DateTimePersian
get_date = DateTimePersian()
print(get_date.getNameDayE(type = 'S'))

_________ output _________
Fri

Example name month Persian :

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

_________ output _________
مرداد

Example name month Gregorian with type = 'en' :

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

_________ output _________
Aug

Example name month Gregorian with type = 'fa' :

from DateTimePersian import DateTimePersian
get_date = DateTimePersian()
print(get_date.getNameMonthE(type = 'fa'))

_________ output _________
اوت

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.1.6.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

DateTimePersian-1.1.6-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: DateTimePersian-1.1.6.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for DateTimePersian-1.1.6.tar.gz
Algorithm Hash digest
SHA256 428892a34d1b0bd027f66282d84671d27c6225a34d761cb49baf7e1193042f21
MD5 2b36b6b3c1448c8e32247a3eabd930fb
BLAKE2b-256 afd09a3e9a7664c90089206bf5f3d6bcb439bb4b1ea8bc2d7ff1bbe7fdd0811c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for DateTimePersian-1.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d66f6eda496f18a4439140d08a713f7be6554b60bf654bea08df3793c8d9fbef
MD5 708ad31750be99cbc50989893140b198
BLAKE2b-256 6f4ab69dbd2dc1eef4bcb7d8ef688dcb006fd4d824cfd72bdb9658a284c97af0

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