2.15.9 strftime

Declaration:

size_t strftime(char *str, size_t maxsize, const char *format, const struct tm *timeptr);

Formats the time represented in the structure timeptr according to the formatting rules defined in format and stored into str. No more than maxsizecharacters are stored into str (including the terminating null character).

All characters in the format string are copied to the str string, including the terminating null character, except for conversion characters. A conversion character begins with the % sign and is followed by another character which defines a special value that it is to be replaced by.

Conversion
Character
What it is replaced by
%aabbreviated weekday name
%Afull weekday name
%babbreviated month name
%Bfull month name
%cappropriate date and time representation
%dday of the month (01-31)
%Hhour of the day (00-23)
%Ihour of the day (01-12)
%jday of the year (001-366)
%mmonth of the year (01-12)
%Mminute of the hour (00-59)
%pAM/PM designator
%Ssecond of the minute (00-61)
%Uweek number of the year where Sunday is the first day of week 1 (00-53)
%wweekday where Sunday is day 0 (0-6)
%Wweek number of the year where Monday is the first day of week 1 (00-53)
%xappropriate date representation
%Xappropriate time representation
%yyear without century (00-99)
%Yyear with century
%Ztime zone (possibly abbreviated) or no characters if time zone isunavailable
%%%

Returns the number of characters stored into str not including the terminating null character. On error zero is returned.