啊峰哥

python获取当前时间

print(time.time())     ========>>>>>>>1509516036.158276
print(time.ctime()) ========>>>>>>>Wed Nov  1 14:00:36 2017
print(time.localtime())========>>>>>>> time.struct_time(tm_year=2017, tm_mon=11, tm_mday=1, tm_hour=14, tm_min=0, tm_sec=36, tm_wday=2, tm_yday=305, tm_isdst=0)
print(time.strftime('%Y-%m-%d',time.localtime(time.time())))========>>>>>>>2017-11-01
print(time.strftime('%H:%M:%S', time.localtime(time.time())))========>>>>>>>14:00:36
print(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time
())))=>>>>>>>2017-11-01 14:00:36





posted on 2017-11-01 14:04  啊峰哥  阅读(443)  评论(0编辑  收藏  举报

导航