Date and Time Format Sepcifiers

Updated 05/04/26


Date and Time Format Specifiers

Format specifiers are replaced by the formatting functions to the corresponding values to represent the date, time or time stamp.
Specifiers begin with a percentage (%) sign.
For example: xbString sMyFormatSpecifier = "%Y-%m-%d %H:%M:%S";


SpecifierReplaced byExamplexbDatexbTimexbTimeStatmp
%aAbbreviated weekday nameThu
Y
Y
%AFull weekday nameThursday
Y
Y
%bAbbreviated month nameAug
Y
Y
%BFull month nameAugust
Y
Y
%cDate and time representationThu Aug 23 14:55:02 2001
Y
Y
%CYear divided by 100 and truncated to integer (00-99)20
Y
Y
%dDay of the month, zero-padded (01-31)23
Y
Y
%DShort MM/DD/YY date, equivalent to %m/%d/%y08/23/01
Y
Y
%eDay of the month, space-padded ( 1-31)23
Y
Y
%FShort YYYY-MM-DD date, equivalent to %Y-%m-%d2001-08-23
Y
Y
%gWeek-based year, last two digits (00-99)01
Y
Y
%GWeek-based year2001
Y
Y
%hAbbreviated month name (same as %b)Aug
Y
Y
%HHour in 24h format (00-23)14
Y
Y
%IHour in 12h format (01-12)02
Y
Y
%jDay of the year (001-366)235
Y
Y
%mMonth as a decimal number (01-12)08
Y
Y
%MMinute (00-59)55
Y
Y
%nNew-line character
Y
Y
Y
%pAM or PM designationPM
Y
Y
%r12-hour clock time02:55:02 pm
Y
Y
%R24-hour HH:MM time, equivalent to %H:%M14:55
Y
Y
%SSecond (00-61)02
Y
Y
%tHorizontal-tab character
Y
Y
Y
%TISO 8601 time format (HH:MM:SS), equivalent to %H:%M:%S14:55:02
Y
Y
%uISO 8601 weekday as number with Monday as 1 (1-7)4
Y
Y
%UWeek number with the first Sunday as the first day of week one (00-53)33
Y
Y
%VISO 8601 week number (01-53)34
Y
Y
%wWeekday as a decimal number with Sunday as 0 (0-6)4
Y
Y
%WWeek number with the first Monday as the first day of week one (00-53)34
Y
Y
%xDate representation08/23/01
Y
Y
%XTime representation14:55:02
Y
Y
%yYear, last two digits (00-99)01
Y
Y
%YYear2001
Y
Y
%%A % sign%
Y
Y
Y