slashmili / python-jalali

Jalali calendar binding for Python based on Python's datetime module
http://pypi.python.org/pypi/jdatetime/
Other
344 stars 49 forks source link

how can i get yesterday #61

Closed saeedsafavi26 closed 5 years ago

saeedsafavi26 commented 5 years ago

hello, i use bellow code to code to get today's jalali date: jdatetime.datetime.now().strftime("%Y %m %d") how can i get yesteday in above format??

farzadghanei commented 5 years ago

@saeedsafavi26 this is a usage question, not a library issue. QA forums like StackOverflow are better options than here. jdatetime implements the same interface as Python standard library datetime, so the same operations apply to it.

>>> from jdatetime import datetime, timedelta
>>> datetime.now() - timedelta(days=1)
jdatetime.datetime(1398, 7, 2, 16, 53, 26, 558957)