标签:bsp src str end import class python基础 ftime 日期
import datetime end_time = 1525104000000 d = datetime.datetime.fromtimestamp(end_time / 1000, None) # 时间戳转换成字符串日期时间 e = datetime.date.fromtimestamp(end_time /1000) # 时间戳转换成字符串日期 str1 = d.strftime("%Y-%m-%d %H:%M:%S.%f") now = datetime.datetime.now() aDay = datetime.timedelta(days=-1) # 减1天 now_aDay = now + aDay print(d) # 2018-05-01 00:00:00 print(e) # 2020-03-15 print(str1) # 2018-05-01 00:00:00.000000 print(now) # 2020-03-16 22:54:26.09290 print(now.strftime(‘%Y-%m-%d‘)) # 2020-03-16 print(now_aDay.strftime(‘%Y-%m-%d‘)) # 2020-03-15
相信很多人都容易搞混,好记性不如烂笔头
标签:bsp src str end import class python基础 ftime 日期
原文地址:https://www.cnblogs.com/hightech/p/12507737.html