Skip to content

Instantly share code, notes, and snippets.

@ekm507
Created December 18, 2022 15:44
Show Gist options
  • Save ekm507/7c3d2c9e1191cac824c6058da00c8a33 to your computer and use it in GitHub Desktop.
Save ekm507/7c3d2c9e1191cac824c6058da00c8a33 to your computer and use it in GitHub Desktop.
jalali to gregorian convert
#!/usr/bin/python3
# Jalali to Gregorian convert. cli tool.
# usage: j2g.py 1401 11 12
# to use, first install jdatetime lib using pip:
# pip install jdatetime
import jdatetime as j
from sys import argv
jdate_str = argv[1:4]
jy, jm, jd = map(int, jdate_str)
jdate = j.JalaliToGregorian(jy, jm, jd)
print(jdate.gyear, jdate.gmonth, jdate.gday)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment