print('格式化输出当前时间:\n', time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()))
格式化输出当前时间:
2021-01-23 13:...times = time.strptime('2021/01/23', '%Y/%m/%d')
print('字符串转strut_time对象:\n', times)
字符串转strut_time对象:...)方法,格式说明符同time库一致;
date1 = date(2020, 1, 23)
print('格式化输出时间:\n', date1.strftime('%Y-%m-%d'))
格式化输出时间:...(datetime1, '%Y-%m-%d %H:%M:%S'))
print('datetime对象转字符串:\n', datetime.strftime(datetime1, '%Y-%m-%d')...) #注意,此时仍属于datetime对象而不是date对象
print('字符串转datetime对象:\n', datetime.strptime(time_str1, '%Y/%m/%d %H:%