Skip to content
Paul Bunyan Message Logger. The best damn logger there ever was. WordPress, PHP, MySQL.

Time Format Syntax

Paul Bunyan uses the MFC function COleDateTime::Format to carry out the formatting, which presently uses the ANSI C run-time function strftime. The syntax for the format string is explained in the tab…

Updated · By Diamond Sierra

On this page

Remarks

Paul Bunyan uses the MFC function COleDateTime::Format to carry out the formatting, which presently uses the ANSI C run-time function strftime. The syntax for the format string is explained in the tables below.

Format codes

The format string consists of one or more formatting codes which are preceded by a percent sign (%). Characters that do not begin with % are copied unchanged. The formatting codes are listed below:

Width3Width9198Width3Width1458 Width3Width7740 %aAbbreviated weekday nameWidth3Width9198Width3Width1458 Width3Width7740
Width3Width9198Width3Width1458 Width3Width7740 %bAbbreviated month nameWidth3Width9198Width3Width1458 Width3Width7740
%BFull month nameWidth3Width9198Width3Width1458 Width3Width7740
%cDate and time representation appropriate for localeWidth3Width9198Width3Width1458 Width3Width7740
%dDay of month as decimal number (01 – 31)Width3Width9198Width3Width1458 Width3Width7740
%HHour in 24-hour format (00 – 23)Width3Width9198Width3Width1458 Width3Width7740
%IHour in 12-hour format (01 – 12)Width3Width9198Width3Width1458 Width3Width7740
%jDay of year as decimal number (001 – 366)Width3Width9198Width3Width1458 Width3Width7740
%mMonth as decimal number (01 – 12)Width3Width9198Width3Width1458 Width3Width7740
%MMinute as decimal number (00 – 59)Width3Width9198Width3Width1458 Width3Width7740
%pCurrent locale's A.M./P.M. indicator for 12-hour clockWidth3Width9198Width3Width1458 Width3Width7740
%SSecond as decimal number (00 – 59)Width3Width9198Width3Width1458 Width3Width7740
%UWeek of year as decimal number, with Sunday as first day of week (00 – 51)Width3Width9198Width3Width1458 Width3Width7740
%wWeekday as decimal number (0 – 6; Sunday is 0)Width3Width9198Width3Width1458 Width3Width7740
%WWeek of year as decimal number, with Monday as first day of week (00 – 51)Width3Width9198Width3Width1458 Width3Width7740
%xDate representation for current localeWidth3Width9198Width3Width1458 Width3Width7740
%XTime representation for current localeWidth3Width9198Width3Width1458 Width3Width7740
%yYear without century, as decimal number (00 – 99)Width3Width9198Width3Width1458 Width3Width7740
%YYear with century, as decimal numberWidth3Width9198Width3Width1458 Width3Width7740
%z, %ZTime-zone name or abbreviation; no characters if time zone is unknownWidth3Width9198Width3Width1458 Width3Width7740
% n .Fraction of second; n is the number of decimal places [1-7] to display. E.g. “%4.”Width3Width9198Width3Width1458 Width3Width7740
Width3Width9198Width3Width1458 Width3Width7740 %%Percent signWidth3Width9198Width3Width1458 Width3Width7740

The # flag may prefix any formatting code. In that case, the meaning of the format code is changed as follows:

%#a, %#A, %#b, %#B, %#p, The # flag is ignored.

%#X, %#z, %#Z, %#%

%#c Long date and time representation, appropriate for current locale. For example: "Tuesday, March 14, 1995, 12:41:29".

%#x Long date representation, appropriate to current locale. For example: "Tuesday, March 14, 1995".

%#d, %#H, %#I, %#j, %#m, Remove leading zeros (if any).

%#M, %#S, %#U, %#w,

%#W, %#y, %#Y