Python时间格式化

# -*- coding: utf-8 -*-
"""
@Time:2019/5/28 16:30
@Author: Cai jz
"""
from datetime import datetime
import time
localtime1=datetime.now().strftime('%Y-%m-%d %H:%M:%S %a')
print(locatime1)
localtime2 = datetime.strftime(datetime.now(),'%Y-%m-%d %H:%M:%S %a')
print(localtime2)
local_time1 = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())

print(local_time1)

 

 

你可能感兴趣的:(python学习)