时间format输出格式参考


date --help

%%一个文字的 %
%a当前locale 的星期名缩写(例如: 日,代表星期日)
%A当前locale 的星期名全称 (如:星期日)
%b当前locale 的月名缩写 (如:一,代表一月)
%B当前locale 的月名全称 (如:一月)
%c当前locale 的日期和时间 (如:2005年3月3日 星期四 23:05:25)
%C世纪;比如 %Y,通常为省略当前年份的后两位数字(例如:20)
%d按月计的日期(例如:01)
%D按月计的日期;等于%m/%d/%y
%e按月计的日期,添加空格,等于%_d
%F完整日期格式,等价于 %Y-%m-%d
%gISO-8601 格式年份的最后两位 (参见%G)
%GISO-8601 格式年份 (参见%V),一般只和 %V 结合使用
%h等于%b
%H小时(00-23)
%I小时(00-12)
%j按年计的日期(001-366)
%khour, space padded ( 0..23); same as %_H
%lhour, space padded ( 1..12); same as %_I
%mmonth (01..12)
%Mminute (00..59)
%na newline
%Nnanoseconds (000000000..999999999)
%plocale's equivalent of either AM or PM; blank if not known
%Plike %p, but lower case
%qquarter of year (1..4)
%rlocale's 12-hour clock time (e.g., 11:11:04 PM)
%R24-hour hour and minute; same as %H:%M
%sseconds since 1970-01-01 00:00:00 UTC
%S秒(00-60)
%t输出制表符 Tab
%T时间,等于%H:%M:%S
%u星期,1 代表星期一
%U一年中的第几周,以周日为每星期第一天(00-53)
%VISO-8601 格式规范下的一年中第几周,以周一为每星期第一天(01-53)
%w一星期中的第几日(0-6),0 代表周一
%W一年中的第几周,以周一为每星期第一天(00-53)
%x当前locale 下的日期描述 (如:12/31/99)
%X当前locale 下的时间描述 (如:23:13:48)
%y年份最后两位数位 (00-99)
%Y年份
%z +hhmm数字时区(例如,-0400)
%:z +hh:mm数字时区(例如,-04:00)
%::z +hh:mm:ss数字时区(例如,-04:00:00)
%:::z数字时区带有必要的精度 (例如,-04,+05:30)
%Z按字母表排序的时区缩写 (例如,EDT)

http://www.cplusplus.com/reference/ctime/strftime/

specifierReplaced byExample
%aAbbreviated weekday name *Thu
%AFull weekday name *Thursday
%bAbbreviated month name *Aug
%BFull month name *August
%cDate and time representation *Thu Aug 23 14:55:02 2001
%CYear divided by 100 and truncated to integer (00-99)20
%dDay of the month, zero-padded (01-31)23
%DShort MM/DD/YY date, equivalent to %m/%d/%y08/23/01
%eDay of the month, space-padded ( 1-31)23
%FShort YYYY-MM-DD date, equivalent to %Y-%m-%d2001-08-23
%gWeek-based year, last two digits (00-99)01
%GWeek-based year2001
%hAbbreviated month name * (same as %b)Aug
%HHour in 24h format (00-23)14
%IHour in 12h format (01-12)02
%jDay of the year (001-366)235
%mMonth as a decimal number (01-12)08
%MMinute (00-59)55
%nNew-line character ('\n')
%pAM or PM designationPM
%r12-hour clock time *02:55:02 pm
%R24-hour HH:MM time, equivalent to %H:%M14:55
%SSecond (00-61)02
%tHorizontal-tab character ('\t')
%TISO 8601 time format (HH:MM:SS), equivalent to %H:%M:%S14:55:02
%uISO 8601 weekday as number with Monday as 1 (1-7)4
%UWeek number with the first Sunday as the first day of week one (00-53)33
%VISO 8601 week number (01-53)34
%wWeekday as a decimal number with Sunday as 0 (0-6)4
%WWeek number with the first Monday as the first day of week one (00-53)34
%xDate representation *08/23/01
%XTime representation *14:55:02
%yYear, last two digits (00-99)01
%YYear2001
%zISO 8601 offset from UTC in timezone (1 minute=1, 1 hour=100),If timezone cannot be determined, no characters+100
%ZTimezone name or abbreviation *,if timezone cannot be determined, no charactersCDT
%%A % sign%

There are comments.