Converts the calendar date and time stored in the std::tm object pointed to by t into a character string, according to the format string [fmtbeg, fmtend)
. The format string is the same as used by std::strftime, but each format specifier is processed by an individual call to do_put()
, which can be customized by extending this facet.
Steps through the character sequence
[fmtbeg, fmtend)
, examining the characters. Every character that is not a part of a format sequence is written to the output iterator
outimmediately. To identify format sequences, this function narrows the next character
cin
[fmtbeg, fmtend)
as if by
std::ctype<char_type>(str.getloc()).narrow(c, 0)and if it equals
'%', the next one or two characters are compared to the list of format sequences recognized by
std::strftimeplus any additional implementation-defined formats supported by this locale. For each valid format sequence, a call to
do_put(out, str, fill, t, format, modifier)is made, where
formatis the format sequence character, and
modifieris the optional format sequence modifier (
'E'or
'O'). A value of
'\0'is used if the modifier is absent.
2) Calls the do_put
member function of the most derived class.
Converts the calendar date and time stored in the
std::tmobject pointed to by
tinto a character string, according to the format conversion sequence formed by concatenating
'%', the value of
modifierif not
'\0', and the value of
format. The format is interpreted the same way as the function
std::strftime, except that the formats that are described as locale-dependent are defined by this locale, and additional format specifiers may be supported (the
fillargument is provided for these implementation-defined format specifiers to use). The string is written to the output iterator
out.
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:
%
writes literal %
. The full conversion specification must be %%
. n
t
Y
writes year as a decimal number, e.g. 2017 tm_year
EY
tm_year
y
writes last 2 digits of year as a decimal number (range [00,99]
) tm_year
Oy
tm_year
Ey
%EC
(locale-dependent) tm_year
C
[00,99]
) tm_year
EC
tm_year
G
In ISO 8601 weeks begin with Monday and the first week of the year must satisfy the following requirements:
tm_year
, tm_wday
, tm_yday
g
[00,99]
).
In ISO 8601 weeks begin with Monday and the first week of the year must satisfy the following requirements:
tm_year
, tm_wday
, tm_yday
Month b
writes abbreviated month name, e.g. Oct
(locale dependent) tm_mon
h
b
tm_mon
B
writes full month name, e.g. October
(locale dependent) tm_mon
m
writes month as a decimal number (range [01,12]
) tm_mon
Om
tm_mon
Week U
writes week of the year as a decimal number (Sunday is the first day of the week) (range [00,53]
) tm_year
, tm_wday
, tm_yday
OU
%U
, using the alternative numeric system, e.g. äºåäº instead of 52 in ja_JP locale tm_year
, tm_wday
, tm_yday
W
writes week of the year as a decimal number (Monday is the first day of the week) (range [00,53]
) tm_year
, tm_wday
, tm_yday
OW
%W
, using the alternative numeric system, e.g. äºåäº instead of 52 in ja_JP locale tm_year
, tm_wday
, tm_yday
V
[01,53]
).
In ISO 8601 weeks begin with Monday and the first week of the year must satisfy the following requirements:
tm_year
, tm_wday
, tm_yday
OV
%V
, using the alternative numeric system, e.g. äºåäº instead of 52 in ja_JP locale tm_year
, tm_wday
, tm_yday
Day of the year/month j
writes day of the year as a decimal number (range [001,366]
) tm_yday
d
writes day of the month as a decimal number (range [01,31]
) tm_mday
Od
Single character is preceded by a space.
tm_mday
e
[1,31]
).
Single digit is preceded by a space.
tm_mday
Oe
Single character is preceded by a space.
tm_mday
Day of the week a
writes abbreviated weekday name, e.g. Fri
(locale dependent) tm_wday
A
writes full weekday name, e.g. Friday
(locale dependent) tm_wday
w
writes weekday as a decimal number, where Sunday is 0
(range [0-6]
) tm_wday
Ow
0
, using the alternative numeric system, e.g. äº instead of 2 in ja_JP locale tm_wday
u
1
(ISO 8601 format) (range [1-7]
) tm_wday
Ou
1
, using the alternative numeric system, e.g. äº instead of 2 in ja_JP locale tm_wday
Hour, minute, second H
writes hour as a decimal number, 24 hour clock (range [00-23]
) tm_hour
OH
tm_hour
I
writes hour as a decimal number, 12 hour clock (range [01,12]
) tm_hour
OI
tm_hour
M
writes minute as a decimal number (range [00,59]
) tm_min
OM
tm_min
S
writes second as a decimal number (range [00,60]
) tm_sec
OS
tm_sec
Other c
writes standard date and time string, e.g. Sun Oct 17 04:41:13 2010
(locale dependent) all Ec
x
writes localized date representation (locale dependent) all Ex
X
writes localized time representation, e.g. 18:40:20 or 6:40:20 PM (locale dependent) all EX
D
tm_mon
, tm_mday
, tm_year
F
tm_mon
, tm_mday
, tm_year
r
tm_hour
, tm_min
, tm_sec
R
tm_hour
, tm_min
T
tm_hour
, tm_min
, tm_sec
p
writes localized a.m. or p.m. (locale dependent) tm_hour
z
-0430
), or no characters if the time zone information is not available tm_isdst
Z
writes locale-dependent time zone name or abbreviation, or no characters if the time zone information is not available tm_isdst
Iterator pointing one past the last character that was produced.
No error handling is provided.
The fill character is provided for those implementation-defined format specifiers and for the user-defined overrides of do_put()
that use padding and filling logic. Such implementations typically make use of the formatting flags from str.
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4