python datetime格式化参数

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


Directive Meaning Notes
%a Locale’s abbreviated weekdayname.
%A Locale’s full weekday name.
%b Locale’s abbreviated monthname.
%B Locale’s full month name.
%c Locale’s appropriate date andtime representation.
%d Day of the month as a decimalnumber [01,31].
%f Microsecond as a decimalnumber [0,999999], zero-paddedon the left (1)
%H Hour (24-hour clock) as adecimal number [00,23].
%I Hour (12-hour clock) as adecimal number [01,12].
%j Day of the year as a decimalnumber [001,366].
%m Month as a decimal number[01,12].
%M Minute as a decimal number[00,59].
%p Locale’s equivalent of eitherAM or PM. (2)
%S Second as a decimal number[00,61]. (3)
%U Week 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)
%w Weekday as a decimal number[0(Sunday),6].
%W Week 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)
%x Locale’s appropriate daterepresentation.
%X Locale’s appropriate timerepresentation.
%y Year without century as adecimal number [00,99].
%Y Year with century as a decimalnumber.
%z UTC offset in the form +HHMMor -HHMM (empty string if thethe object is naive). (5)
%Z Time zone name (empty stringif the object is naive).
%% A literal '%' character.
http://docs.python.org/library/datetime.html#strftime-strptime-behavior

你可能感兴趣的:(python datetime格式化参数)