python的time笔记

格式时间==》时间戳
time.mktime(time.strptime(account_data['expire_data'],'%Y-%m-%d'))

格式时间==》结构时间
>>> time.strptime('2020-01-01','%Y-%m-%d')
time.struct_time(tm_year=2020, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=2, tm_yday=1, tm_isdst=-1)

时间戳==》格式时间
time.strftime('%Y-%m-%d',time.localtime('时间戳'))



时间戳 ---localtime--->结构时间-----strftime------>格式时间(2012-01-02)
<---mktime---- <-------strptime------
posted on 2021-01-29 16:53  bruce.sharp  阅读(57)  评论(0)    收藏  举报