python 日期使用

年夜雪

关注

阅读 20

2022-10-08


python 日期使用

import datetime
// 获取当前时间
a = datetime.datetime.now()

// 根据一个时间来获取 一天后的时间
b= (datetime.datetime.strptime(a, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=1)).strftime("%Y-%m-%d %H:%M:%S")

// 获取某个时间的 时间戳格式
def to_mstimestamp(string, format=default_format):
return int(time.mktime(time.strptime(string, format))) * 1000



精彩评论(0)

0 0 举报