python datetime格式化参数

坑爹啊,记忆力不行,老是记不住,都用了这么久了,记在这里以后来翻。


DirectiveMeaningNotes
%aLocale’s abbreviated weekdayname. 
%ALocale’s full weekday name. 
%bLocale’s abbreviated monthname. 
%BLocale’s full month name. 
%cLocale’s appropriate date andtime representation. 
%dDay of the month as a decimalnumber [01,31]. 
%fMicrosecond as a decimalnumber [0,999999], zero-paddedon the left(1)
%HHour (24-hour clock) as adecimal number [00,23]. 
%IHour (12-hour clock) as adecimal number [01,12]. 
%jDay of the year as a decimalnumber [001,366]. 
%mMonth as a decimal number[01,12]. 
%MMinute as a decimal number[00,59]. 
%pLocale’s equivalent of eitherAM or PM.(2)
%SSecond as a decimal number[00,61].(3)
%UWeek number of the year(Sunday as the first day ofthe week) as a decimal number[00,53]. All days in a newyear preceding the firstSunday are considered to be inweek 0.(4)
%wWeekday as a decimal number[0(Sunday),6]. 
%WWeek number of the year(Monday as the first day ofthe week) as a decimal number[00,53]. All days in a newyear preceding the firstMonday are considered to be inweek 0.(4)
%xLocale’s appropriate daterepresentation. 
%XLocale’s appropriate timerepresentation. 
%yYear without century as adecimal number [00,99]. 
%YYear with century as a decimalnumber. 
%zUTC offset in the form +HHMMor -HHMM (empty string if thethe object is naive).(5)
%ZTime zone name (empty stringif the object is naive). 
%%A literal '%' character. 
http://docs.python.org/library/datetime.html#strftime-strptime-behavior

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页