std::strftime (3) - Linux Manuals
std::strftime: std::strftime
Command to display std::strftime
manual in Linux: $ man 3 std::strftime
NAME
std::strftime - std::strftime
Synopsis
Defined in header <ctime>
std::size_t strftime( char* str, std::size_t count, const char* format, const std::tm* time );
Converts the date and time information from a given calendar time time to a null-terminated multibyte character string str according to format string format. Up to count bytes are written.
Parameters
str - pointer to the first element of the char array for output
count - maximum number of bytes to write
pointer to a null-terminated multibyte character string specifying the format of conversion.
The format string consists of zero or more conversion specifiers and ordinary characters (except %). All ordinary characters, including the terminating null character, are copied to the output string without modification. Each conversion specification begins with % character, optionally followed by E or O modifier (ignored if unsupported by the locale), followed by the character that determines the behavior of the specifier. The following format specifiers are available:
Conversion Explanation Used fields
specifier
% writes literal %. The full conversion specification must be %%.
n writes newline character
(C++11)
t writes horizontal tab character
(C++11)
Year
Y writes year as a decimal number, e.g. 2017 tm_year
EY writes year in the alternative representation, e.g.平成23年 (year Heisei 23) instead of 2011年 (year 2011) in ja_JP loctm_year
(C++11)
y writes last 2 digits of year as a decimal number (range [00,99]) tm_year
Oy writes last 2 digits of year using the alternative numeric system, e.g. 十一 instead of 11 in ja_JP locale tm_year
(C++11)
Ey writes year as offset from locale's alternative calendar period %EC (locale-dependent) tm_year
(C++11)
C writes first 2 digits of year as a decimal number (range [00,99]) tm_year
(C++11)
EC writes name of the base year (period) in the locale's alternative representation, e.g. 平成 (Heisei era) in ja_JP tm_year
(C++11)
writes ISO 8601 week-based year, i.e. the year that contains the specified week.
In IS0 8601 weeks begin with Monday and the first week of the year must satisfy the following requirements:
G tm_year, tm_wday, tm_yday
(C++11) * Includes January 4
* Includes first Thursday of the year