python3.6.1 time模块记录
2017-07-18 14:43
260 查看
time模块有两种表示时间的方式:一种是从世界标准时间开始计时,到其他时间之间总的秒数,是一个浮点类型的数字。另一种是用一个九个整数的元组表示时间,元组为
tuple =(year, month(1-12), day(1-31), hours(0-23), minutes(0-59), seconds(0-59), weekday(0-6, Monday is 0), Julian day(1-366), DST(-1, 0, 1))
其中DST表示采取的计时方式,1表示采用夏令时,0表示采用正常计时,-1表示由系统自行判断,采取合适的计时方式。
time模块的主要内容:
asctime()函数的string形式为:
tuple =(year, month(1-12), day(1-31), hours(0-23), minutes(0-59), seconds(0-59), weekday(0-6, Monday is 0), Julian day(1-366), DST(-1, 0, 1))
其中DST表示采取的计时方式,1表示采用夏令时,0表示采用正常计时,-1表示由系统自行判断,采取合适的计时方式。
time模块的主要内容:
import time #4 variables print(time.timezone) #difference in seconds between UTC and local standard time print(time.altzone) #difference in seconds between UTC and local DST time print(time.daylight) #whether local time should reflect DST print(time.tzname) #tuple of (standard time zone name, DST time zone) #default altzone = -32400 daylight = 0 timezone = -28800 tzname = ('\xd6\xd0\xb9ú±ê×\xbc\xca±\xbc\xe4', '\xd6\xd0\xb9ú\xcf\xc4\xc1\xee\xca±') # 11 functions print(time.time()) #return current time in seconds since Epoch as a float print(time.clock()) #return CPU time since process start as a float print(time.sleep(5)) #delay for a number of seconds given as a float print(gmtime(0)) #convert seconds since Epoch to UTC tuple print(localtime()) #convert seconds to local time tuple print(mktime(time.localtime())) #convert local time tuple to seconds since Epoch print(time.asctime()) #convert time tuple to string print(time.ctime()) #convert time in seconds to string print(time.strftime()) #convert time tuple to string according to format specification print(time.strptime()) #convert string to time tuple print(tzset()) #change the local timezone
asctime()函数的string形式为:
string = "Tue Jul 18 12:06:34 2017"
相关文章推荐
- python time datetime模块使用方法记录
- python---time,datetime模块
- Python模块学习:logging 日志记录
- Python时间模块datetime、time、calendar的使用方法
- python-模块之time、datetime
- python sys,os,time模块的使用(包括时间格式的各种转换)
- python:time模块用法
- python使用time模块格式化时间
- Python中time和datetime模块对时间的操作
- python time模块详解
- Python模块——time
- 记录我所接触的python模块
- 基础入门_Python-模块和包.深入Celery之任务绑定/记录日志/自动重试?
- python3 datetime() 模块之 date、time 类
- python: time模块、datetime模块
- Python 之 time模块详解
- Python time模块
- Python中time模块详解(转)
- Python time时间模块学习
- Python中time模块详解