格式化当前日期:
import time print time.strftime('%Y-%m-%d')
获取一天前的日期:
import datetime import time onedayago=(datetime.datetime.now() - datetime.timedelta(days = 1)) print onedayago.strftime('%Y-%m-%d')
2024-02-18 20:19:34
格式化当前日期:
import time print time.strftime('%Y-%m-%d')
获取一天前的日期:
import datetime import time onedayago=(datetime.datetime.now() - datetime.timedelta(days = 1)) print onedayago.strftime('%Y-%m-%d')