2021年3月12日星期五

Print date of 1 month ago python

The problem:

I am trying to print out the date from a month ago. So instead of the result being:

>>> 2021-03-12  

It will be in this instead

>>> 2021-02-12  

Here is my code:

from datetime import date  import datetime  from email.utils import formatdate    now = formatdate(timeval=None, localtime=False, usegmt=True)  tday = date.today()    print(tday)  

I have seen tons of different examples but all of them change the format of the date structure that I already have.

https://stackoverflow.com/questions/66609067/print-date-of-1-month-ago-python March 13, 2021 at 08:53AM

没有评论:

发表评论