Skip to content

Jangal/python-dilami-calendar

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

python-dilami-calendar

Build Status PyPI PyPI - Python Version GitHub license

Install

pip install dilami-calendar

Usage

Get current datetime in Dilami

from dilami_calendar import DilamiDatetime

print(DilamiDatetime.now())

Convert Gregorian datetime to Dilami

from datetime import datetime
from dilami_calendar import DilamiDatetime

gregorian_datetime = datetime(2018, 2, 1)
dilami_datetime = DilamiDatetime(gregorian_datetime)

Convert Dilami to Gregorian datetime

from dilami_calendar import DilamiDatetime

dilami_datetime = DilamiDatetime(1591, 6, 28)
gregorian_datetime = dilami_datetime.to_datetime()

Read attributes

from dilami_calendar import DilamiDatetime

d = DilamiDatetime().now()
print(
    d.year,
    d.month,
    d.day,
    d.hour,
    d.minute,
    d.second
)

Set time-zone

import pytz
from dilami_calendar import DilamiDatetime

d = DilamiDatetime(tzinfo=pytz.timezone('Asia/Tehran')).now()
print(d)

Maybe You Like

PHP Dilami Calendar
C++ Dilami Calendar
Arduino Dilami Calendar
.Net Dilami Calendar
تقویم دیلمی

Credits