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 Persian | getYearP() | object | int |
Year Gregorian | getYearE() | object | int |
Month Persian | getMonthP() | object | int |
Month Gregorian | getMonthE() | object | int |
Day Persian | getDayP() | object | int |
Day Gregorian | getDayE() | object | int |
Hour | getHour() | object | str |
Minutes | getMin() | object | str |
Seconds | getSec() | object | str |
leap year | lYear(year) | static | int |
leap check | is_leap(year) | object | bool |
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 Leap Check :
from DateTimePersian import DateTimePersian
date = DateTimePersian()
print(date.is_leap(1403))
_________ output _________
True
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 _________
اوت
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
Built Distribution
File details
Details for the file datetimepersian-1.3.0.tar.gz
.
File metadata
- Download URL: datetimepersian-1.3.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d796b2afb08fc31f6d99d3701776b4d167facb06938911fdd9e3ab9484ded42 |
|
MD5 | 418688fa3b534ecef0aabdf8ef46cf5f |
|
BLAKE2b-256 | ee0eff9eb00f64381879abe47f439306b86db05a08dab9983fc66b00c39fe59f |
File details
Details for the file DateTimePersian-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: DateTimePersian-1.3.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68d1167eafd7ea75b09403806dafb334b3db358c94ec5c00f95a27b4a7e44a51 |
|
MD5 | ab55ff8a0f31d2b07eb33f6e84331d41 |
|
BLAKE2b-256 | e3813a75bca7e470d76a721a0c5ae687e0eb901ecc20fe7f1a6f75ea4f0b18c3 |