std::put_time (3) - Linux Manuals
std::put_time: std::put_time
Command to display std::put_time
manual in Linux: $ man 3 std::put_time
NAME
std::put_time - std::put_time
Synopsis
Defined in header <iomanip>
template< class CharT > (since C++11)
/*unspecified*/ put_time( const std::tm* tmb, const CharT* fmt );
When used in an expression out << put_time(tmb, fmt), converts the date and time information from a given calendar time tmb to a character string according to format string fmt, as if by calling std::strftime, std::wcsftime, or analog (depending on CharT), according to the std::time_put facet of the locale currently imbued in the output stream out.
Parameters
tmb - pointer to the calendar time structure as obtained from std::localtime or std::gmtime
pointer to a null-terminated CharT 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
writes last 2 digits of ISO 8601 week-based year, i.e. the year that contains the specified week (range [00,99]).
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
Month
b writes abbreviated month name, e.g. Oct (locale dependent) tm_mon
h synonym of b tm_mon
(C++11)