需要輸入一個(gè)數(shù)字,然后獲取當(dāng)天日期,并以此數(shù)字倒推相應(yīng)的天數(shù),獲得那時(shí)的日期,記錄下
import datetime
def get_date(days):
a=str(datetime.date.today()-datetime.timedelta(days=int(days))).replace('-','.')
return a
print get_date(30)
需要輸入一個(gè)數(shù)字,然后獲取當(dāng)天日期,并以此數(shù)字倒推相應(yīng)的天數(shù),獲得那時(shí)的日期,記錄下
import datetime
def get_date(days):
a=str(datetime.date.today()-datetime.timedelta(days=int(days))).replace('-','.')
return a
print get_date(30)