Time Format Syntax

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 %a Abbreviated weekday nameWidth3Width9198Width3Width1458 Width3Width7740
Width3Width9198Width3Width1458 Width3Width7740 %b Abbreviated month nameWidth3Width9198Width3Width1458 Width3Width7740
%B Full month nameWidth3Width9198Width3Width1458 Width3Width7740
%c Date and time representation appropriate for localeWidth3Width9198Width3Width1458 Width3Width7740
%d Day of month as decimal number (01 – 31)Width3Width9198Width3Width1458 Width3Width7740
%H Hour in 24-hour format (00 – 23)Width3Width9198Width3Width1458 Width3Width7740
%I Hour in 12-hour format (01 – 12)Width3Width9198Width3Width1458 Width3Width7740
%j Day of year as decimal number (001 – 366)Width3Width9198Width3Width1458 Width3Width7740
%m Month as decimal number (01 – 12)Width3Width9198Width3Width1458 Width3Width7740
%M Minute as decimal number (00 – 59)Width3Width9198Width3Width1458 Width3Width7740
%p Current locale's A.M./P.M. indicator for 12-hour clockWidth3Width9198Width3Width1458 Width3Width7740
%S Second as decimal number (00 – 59)Width3Width9198Width3Width1458 Width3Width7740
%U Week of year as decimal number, with Sunday as first day of week (00 – 51)Width3Width9198Width3Width1458 Width3Width7740
%w Weekday as decimal number (0 – 6; Sunday is 0)Width3Width9198Width3Width1458 Width3Width7740
%W Week of year as decimal number, with Monday as first day of week (00 – 51)Width3Width9198Width3Width1458 Width3Width7740
%x Date representation for current localeWidth3Width9198Width3Width1458 Width3Width7740
%X Time representation for current localeWidth3Width9198Width3Width1458 Width3Width7740
%y Year without century, as decimal number (00 – 99)Width3Width9198Width3Width1458 Width3Width7740
%Y Year with century, as decimal numberWidth3Width9198Width3Width1458 Width3Width7740
%z, %Z Time-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, %#%

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

%#xLong 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