码迷,mamicode.com
首页 > 其他好文 > 详细

time 模块

时间:2019-11-10 13:25:41      阅读:81      评论:0      收藏:0      [点我收藏+]

标签:int   pre   localtime   code   运行   sds   author   alt   模块   

 1 # Author:CallMeV
 2 # DATE  :2019-11-10
 3 # Time  : 12:47
 4 
 5 import time
 6 print("time.time()is:>>>",time.time())
 7 print("time.strftime()is:>>>",time.strftime("%Y-%m-%d %H:%M:%S",time.gmtime()))
 8 print("time.gmtime()is:>>>",time.gmtime())  #UTC 格林尼治时间
 9 print("time.localtime()is:>>>",time.localtime())
10 print("time.ctime()is:>>>",time.ctime())
11 
12 import datetime
13 print("datetime.datetime.now()is:>>>",datetime.datetime.now())

运行结果如下:

1 time.time()is:>>> 1573361892.4201996
2 time.strftime()is:>>> 2019-11-10 04:58:12
3 time.gmtime()is:>>> time.struct_time(tm_year=2019, tm_mon=11, tm_mday=10, tm_hour=4, tm_min=58, tm_sec=12, tm_wday=6, tm_yday=314, tm_isdst=0)
4 time.localtime()is:>>> time.struct_time(tm_year=2019, tm_mon=11, tm_mday=10, tm_hour=12, tm_min=58, tm_sec=12, tm_wday=6, tm_yday=314, tm_isdst=0)
5 time.ctime()is:>>> Sun Nov 10 12:58:12 2019
6 datetime.datetime.now()is:>>> 2019-11-10 12:58:12.421197

 

time 模块

标签:int   pre   localtime   code   运行   sds   author   alt   模块   

原文地址:https://www.cnblogs.com/fly10086/p/11829578.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!