time.strftime
time.strftime的意思
time.strftime的意思
2019-02-11
demo:
import time t = (2019, 1, 1, 1, 1, 1, 0, 0, 0) print(time.strftime('%Y:%m:%d', t)) # 参数: fmt, [Tuple, struct time] # 返回值: 格式化的时间数据 # 目的: 将一个标准的时间格式, 修改为自定义的时间格式 # 比如: # 标准时间为:time.struct_time(tm_year=2019, tm_mon=2, tm_mday=12, tm_hour=17, tm_min=37, tm_sec=38, tm_wday=1, tm_yday=43, tm_isdst=0) # 看起来不舒服, 所以可以修改为2019-2-12, 这样看起来直观
time.
strftime
(format)
Return a string representing the time, controlled by an explicit format string. For a complete list of formatting directives, see strftime() and strptime() Behavior.
举报