当前位置 : 主页 > 编程语言 > python >

python datetime时区 timedelta

来源:互联网 收集:自由互联 发布时间:2022-06-21
#!/usr/bin/python # -*- coding: utf8 -*- from datetime import datetime, timedelta now = datetime.now() # current date and time now_up = now - timedelta (days = 5 ) now_up = now_up.strftime( "%Y-%m-%dT%H:%M:%S+08:00" ) date_time = now.strfti
#!/usr/bin/python
# -*- coding: utf8 -*-
from datetime import datetime, timedelta
now = datetime.now() # current date and time
now_up = now - timedelta(days=5)
now_up = now_up.strftime("%Y-%m-%dT%H:%M:%S+08:00")
date_time = now.strftime("%Y-%m-%dT%H:%M:%S+08:00")

start_time = str(now_up)
end_time = str(date_time)
print(start_time)
print(end_time)


上一篇:python函数执行超时处理的两种方法
下一篇:没有了
网友评论