Python time 模块

常用

# float 整数位为秒
time.time()

# struct_time
time.localtime()

# string
time.ctime()

# string
time.asctime()

转换

# struct_time
time.localtime(float)

# float
time.mktime(struct_time) 

# struct_time
time.strptime(string, "%Y-%m-%d %H:%M:%S")

# string
time.strftime("%Y-%m-%d")


posted @ 2023-06-03 11:35  太晓  阅读(2)  评论(0编辑  收藏  举报