C++ Programming/Code/Standard C Library/Functions/strftime

strftime

Syntax
#include <ctime>
size_t strftime( char *str, size_t maxsize, const char *fmt, struct tm *time );

The function strftime() formats date and time information from time to a format specified by fmt, then stores the result in str (up to maxsize characters). Certain codes may be used in fmt to specify different types of time:

CodeMeaning
%aabbreviated weekday name (e.g. Fri)
%Afull weekday name (e.g. Friday)
%babbreviated month name (e.g. Oct)
%Bfull month name (e.g. October)
%cthe standard date and time string
%dday of the month, as a number (01-31) with a leading zero
 %-dday of the month, as a number (1-31) without a leading zero
%Hhour, 24 hour format (0-23)
%Ihour, 12 hour format (1-12)
%jday of the year, as a number (1-366)
%mmonth as a number (1-12).
%Mminute as a number (0-59)
%plocale's equivalent of AM or PM
%Ssecond as a number (0-59)
%Uweek of the year, (0-53), where week 1 has the first Sunday
%wweekday as a decimal (0-6), where Sunday is 0
%Wweek of the year, (0-53), where week 1 has the first Monday
%xstandard date string
%Xstandard time string
%yyear in decimal, without the century (0-99)
%Yyear in decimal, with the century
%Ztime zone name
 %%a percent sign

Note: Some versions of Microsoft Visual C++ may use values that range from 0-11 to describe %m (month as a number).

Related topics
gmtime - localtime - time
Category:Book:C++ Programming#Code/Standard%20C%20Library/Functions/strftime%20
Category:Book:C++ Programming