time 模块
time.time() #获取当前时间戳 1587743489.9542704 time.localtime() #获取本地时间,年月日时分秒周,一年中第几天 time.struct_time(tm_year=2020, tm_mon=4, tm_mday=24, tm_hour=23, tm_min=52, tm_sec=3, tm_wday=4, tm_yday=115, tm_isdst=0) time.ctime() #转成字符形式 'Fri Apr 24 23:56:24 2020' time.strftime('%Y-%m-%d',time.localtime()) #localtime转字符串时间形式时间格式 '2020-04-24' time.strptime('2020-4-24','%Y-%m-%d') time.struct_time(tm_year=2020, tm_mon=4, tm_mday=24, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=4, tm_yday=115, tm_isdst=-1)
posted on 2020-04-25 00:12 __director 阅读(109) 评论(0) 编辑 收藏 举报