Search This Blog

Thursday 28 February 2013

Convert Jalali Date to Gregorian and Gregorian to Jalali Using Python

You are required to download the jdatetime library

you can download from here

Download jdatetime library from here

Click Here Download



Install this library in your system :.

Extract the library folder and reach inside that library folder in command prompt and install .

- apt get install setup.py

Try this script :

from jdatetime import JalaliToGregorian, GregorianToJalali


gregorian_date_obj = JalaliToGregorian(1391,02,21)


gregorian_date =gregorian_date_obj.getGregorianList()

print " gregorian_date  :::::::",gregorian_date


same way you can use the ,


jalali_date_obj =  GregorianToJalali(2012,1,31)


jalali_date = jalali_date_obj.getJalaliList()


print  "jalali_date :::::::::::::",jalali_date