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 .%fMicrosecond as a decimalnumber , zero-paddedon the left(1)%HHour (24-hour clock) as adecimal number .%IHour (12-hour clock) as adecimal number .%jDay of the year as a decimalnumber .%mMonth as a decimal number.%MMinute as a decimal number.%pLocale’s equivalent of eitherAM or PM.(2)%SSecond as a decimal number.(3)%UWeek number of the year(Sunday as the first day ofthe week) as a decimal number. All days in a newyear preceding the firstSunday are considered to be inweek 0.(4)%wWeekday as a decimal number.%WWeek number of the year(Monday as the first day ofthe week) as a decimal number. 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 .%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
页:
[1]