时间
python提供 一个time和calendar模块可以用于格式化日期和时间
Time模块内置函数
#time.altzone:返回格林威治西部的夏令时地区的偏移秒数
#time.asctime(tupletime):接受时间元组并返回一个可读形式为Tue Dec 11 18:07:14 2008 的字符串
#time.clock():用以浮点数计算的秒数返回当前的CPU时间,用来衡量不同程序的耗时。
#time.gmtime([secs]):接受时间戳并返回格林威治天文时间下的时间元组t
#time.localtime([secs]):接受时间戳并返回当地时间下的时间元组t
#time.mktime(tupletime):接受时间元组并返回时间戳
#time.sleep(secs):推迟调用线程的运行,secs指秒数
#time.strftime(fmt[,tupletime]):接受时间元组并返回刻度字符串表示的当地时间,格式有fmt决定
#time.strptime(str.fmt='%a%b%d%H:%M:%S %Y'):根据fmt的格式把一个时间字符串解析为时间元组
#time.time()返回当前时间的时间戳
#time.tzset():根据环境变量TZ重新初始化时间相关设置
日历Calendar内置函数
#calendar.calendar(year,w=2,l=1,c=6):返回一个多行字符串格式的year年年历,3个月一行间距为c,每日宽度间隔为w字符。每行长度为21*w+18+2*c。l是每星期行数
#calendar.firstweekday():返回当前每周其实日期的设置。默认情况下,首次载入calendar模块时返回0,即周一
#calendar.isleap(year):是闰年返回True 否则返回False
#calendar.leapdays(y1,y2):返回在y1,y2两年之间的闰年总数
#calendar.month(year,month,w=2,l=1):返回一个多行字符串格式的year年month月日历,两行标题,一周一行。
#calendar.monthrange(year,month):返回两个整数,第一个是该月的星期几的日期码,第二个是该月的日期码。
#calendar.setfirstweek(weekday):设置每周的其实日期码
#calendar.timegm(tupletime):接受时间元组的形式,放回时间戳
#calendar.weekday(year,month,week):返回给定日期的日期码。
datetime模块
https://www.cnblogs.com/awakenedy/articles/9182036.html