时间显示

import time
import datetime

print(time.localtime(),type(time.localtime()))

create_time=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print(create_time,type(create_time))

update_time=time.strftime('%Y-%m-%d %X',time.localtime(time.time()))
print(update_time,type(update_time))

显示如下:

time.struct_time(tm_year=2019, tm_mon=2, tm_mday=12, tm_hour=9, tm_min=48, tm_sec=38, tm_wday=1, tm_yday=43, tm_isdst=0) <class 'time.struct_time'>
2019-02-12 09:48:38 <class 'str'>
2019-02-12 09:48:38 <class 'str'>



posted on 2019-02-12 09:50  jak06  阅读(178)  评论(0编辑  收藏  举报