Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mjnaderi/jalali.py
Persian and Gregorian Date Converter for Python 2 and Python 3
https://github.com/mjnaderi/jalali.py
calendar converter gregorian jalali python
Last synced: 3 days ago
JSON representation
Persian and Gregorian Date Converter for Python 2 and Python 3
- Host: GitHub
- URL: https://github.com/mjnaderi/jalali.py
- Owner: mjnaderi
- Created: 2014-05-06T13:04:37.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-02-01T20:48:08.000Z (almost 7 years ago)
- Last Synced: 2024-11-17T16:41:25.244Z (2 months ago)
- Topics: calendar, converter, gregorian, jalali, python
- Language: Python
- Homepage:
- Size: 174 KB
- Stars: 151
- Watchers: 6
- Forks: 24
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Jalali.py
=========Jalali.py is a simple Python code for converting between Persian date and Gregorian date. It is a port of http://jdf.scr.ir/ (PHP).
Sample Usage
--------```python
>>> import jalali>>> jalali.Persian('1393-1-11').gregorian_string()
'2014-3-31'
>>> jalali.Persian(1393, 1, 11).gregorian_datetime()
datetime.date(2014, 3, 31)
>>> jalali.Persian('1393/1/11').gregorian_string("{}/{}/{}")
'2014/3/31'
>>> jalali.Persian((1393, 1, 11)).gregorian_tuple()
(2014, 3, 31)>>> jalali.Gregorian('2014-3-31').persian_string()
'1393-1-11'
>>> jalali.Gregorian('2014,03,31').persian_tuple()
(1393, 1, 11)
>>> jalali.Gregorian(2014, 3, 31).persian_string("{0}")
'1393'
```Original License
----------------
As mentioned in http://jdf.scr.ir/, the original code is free and open source, and you are not allowed to sell it. You can read more in http://jdf.scr.ir/.