Python:日期时间格式化(带毫秒)

import datetime
 
print(datetime.datetime.now())  # 2019-01-28 11:09:01.529864
print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f'))  # 2019-01-28 11:09:01.529864
print(datetime.datetime.now().strftime('%Y%m%d%H%M%S%f'))  # 20190128110901529864

 

posted @ 2021-12-26 16:17  锐洋智能  阅读(209)  评论(0编辑  收藏  举报