=2016, tm_mon=6, tm_mday=8, tm_hour=16, tm_min=34, tm_sec=8, tm_wday=2, tm_yday=160, tm_isdst=-1) #datetime.replace
month|day|hour|minute|second|microsecond|tzinfo] datetime.date(): 获取date对象 datetime.time(): 获取time对象 datetime.replace
可能有人会说,用 datetime.replace 方法将 month-1 就好了,咋看起来没问题,实际上这是有 bug 的,month 的范围只能是 1-12 >>> d.replace(month=
datetime.second 秒 datetime.microsecond 毫秒 datetime.date() # 返回 date 对象 datetime.time() # 返回 time 对象 datetime.replace
month、day、hour、minute、second、microsecond、tzinfo: datetime.date():获取date对象; datetime.time():获取time对象; datetime.replace
print(current_time) #输出2016-01-26 19:04:30.335935 print(current_time.timetuple()) #返回struct_time格式 #datetime.replace
实例方法 datetime.date(): 返回相同年月日的date对象. datetime.time(): 返回相同时分秒微秒的time对象. datetime.replace(kw): kw in
datetime.replace(kw): kw in [year, month, day, hour, minute, second, microsecond, tzinfo], 与date类似.
对象datetime.time() - 返回一个 time 对象(tzinfo 属性为 None) datetime.timetz() - 返回一个 time() 对象(带有 tzinfo 属性) datetime.replace
领取专属 10元无门槛券
手把手带您无忧上云