1.用Python得到当前日期
from time import gmtime, strftime
strftime("%Y%m%d", gmtime())
2.得到与当前日期相差的日期
def getDiffdaystr(daynum,style="%Y-%m-%d"):
return datetime.fromtimestamp(time.time()-int(daynum)*3600*24).strftime(style)
1.用Python得到当前日期
from time import gmtime, strftime
strftime("%Y%m%d", gmtime())
2.得到与当前日期相差的日期
def getDiffdaystr(daynum,style="%Y-%m-%d"):
return datetime.fromtimestamp(time.time()-int(daynum)*3600*24).strftime(style)