Espaces de noms
Variantes
Affichages
Actions

std::get_time

De cppreference.com
< cpp‎ | io‎ | manip

 
 
D'entrée / sortie de bibliothèque
I / O manipulateurs
C-style I / O
Tampons
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf (obsolète)
Cours d'eau
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Abstractions
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
Fichier E / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
Chaîne I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
Tableau I / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream (obsolète)
ostrstream (obsolète)
strstream (obsolète)
Types
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
Interface catégorie d'erreur
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category (C++11)
io_errc (C++11)
 
D'entrée / sortie manipulateurs
À virgule flottante en forme
Original:
Floating-point formatting
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Formatage entier
Original:
Integer formatting
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Formatage booléen
Original:
Boolean formatting
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
boolalpha
noboolalpha
Largeur de champ et de contrôle de remplissage
Original:
Field width and fill control
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Autre mise en forme
Original:
Other formatting
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Traitement des espaces blancs
Original:
Whitespace processing
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Sortie de rinçage
Original:
Output flushing
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Indicateurs d'état manipulation
Original:
Status flags manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Temps et d'argent I / O
Original:
Time and money I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
get_money (C++11)
get_time (C++11)
put_money (C++11)
put_time (C++11)
 
Defined in header <iomanip>
template< class CharT >
/*unspecified*/ get_time( std::tm* tmb, const CharT* fmt);
(depuis C++11)
Lorsque utilisées dans une expression in >> get_time(tmb, fmt), analyse la saisie de caractères comme une valeur date / heure selon la chaîne de format fmt selon la facette std::time_get de la locale courante imprégnée dans le out flux de sortie. La valeur résultante est stockée dans un objet pointé par std::tm tmb .
Original:
When used in an expression in >> get_time(tmb, fmt), parses the character input as a date/time value according to format string fmt according to the std::time_get facet of the locale currently imbued in the output stream out. The resultant value is stored in a std::tm object pointed to by tmb.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Sommaire

[modifier] Paramètres

tmb -
pointeur valide à l'objet std :: tm où le résultat sera stocké
Original:
valid pointer to the std::tm object where the result will be stored
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
fmt -
pointeur vers une chaîne terminée par null Graphique de spécifier le format de conversion
La chaîne de format se compose de spécificateurs de conversion à zéro ou plusieurs caractères d'espacement, et des caractères ordinaires (à l'exception %). Chaque caractère ordinaire est censé correspondre à un caractère dans le flux d'entrée en comparaison insensible. Chaque caractère d'espacement correspond arbitraire espaces dans la chaîne d'entrée. Chaque spécification de conversion commence avec le caractère %, éventuellement suivie d'E ou modificateur O (ignoré si non pris en charge par la locale), suivi par le caractère qui détermine le comportement du prescripteur. Les spécificateurs de format correspondent à la fonction POSIX strptime():
Original:
The format string consists of zero or more conversion specifiers, whitespace characters, and ordinary characters (except %). Each ordinary character is expected to match one character in the input stream in case-insensitive comparison. Each whitespace character matches arbitrary whitespace in the input string. 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 format specifiers match the POSIX function strptime():
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Conversion
specifier
Explanation Writes to fields
% matches a literal %. The full conversion specification must be %%. (none)
t matches any whitespace. (none)
n matches any whitespace. (none)
Year
Y parses full year as a 4 digit decimal number, leading zeroes permitted but not required tm_year
EY parses year in the alternative representation, e.g.平成23年 (year Heisei 23) which writes 2011 to tm_year in ja_JP locale tm_year
y parses last 2 digits of year as a decimal number. Range [69,99] results in values 1969 to 1999, range [00,68] results in 2000-2068 tm_year
Oy parses last 2 digits of year using the alternative numeric system, e.g. 十一 is parsed as 11 in ja_JP locale tm_year
Ey parses year as offset from locale's alternative calendar period %EC tm_year
C parses the first 2 digits of year as a decimal number (range [00,99]) tm_year
EC parses the name of the base year (period) in the locale's alternative representation, e.g. 平成 (Heisei era) in ja_JP tm_year
Month
b parses the month name, either full or abbreviated, e.g. Oct tm_mon
h synonym of b tm_mon
B synonym of b tm_mon
m parses the month as a decimal number (range [01,12]), leading zeroes permitted but not required tm_mon
Om parses the month using the alternative numeric system, e.g. 十二 parses as 12 in ja_JP locale tm_mon
Week
U parses the week of the year as a decimal number (Sunday is the first day of the week) (range [00,53]), leading zeroes permitted but not required tm_year, tm_wday, tm_yday
OU parses the week of the year, as by %U, using the alternative numeric system, e.g. 五十二 parses as 52 in ja_JP locale tm_year, tm_wday, tm_yday
W parses the week of the year as a decimal number (Monday is the first day of the week) (range [00,53]), leading zeroes permitted but not required tm_year, tm_wday, tm_yday
OW parses the week of the year, as by %W, using the alternative numeric system, e.g. 五十二 parses as 52 in ja_JP locale tm_year, tm_wday, tm_yday
Day of the year/month
j parses day of the year as a decimal number (range [001,366]), leading zeroes permitted but not required tm_yday
d parses the day of the month as a decimal number (range [01,31]), leading zeroes permitted but not required tm_mday
Od parses the day of the month using the alternative numeric system, e.g 二十七 parses as 23 in ja_JP locale, leading zeroes permitted but not required tm_mday
e synonym of d tm_mday
Oe synonym of Od tm_mday
Day of the week
a parses the name of the day of the week, either full or abbreviated, e.g. Fri tm_wday
A synonym of a tm_wday
w parses weekday as a decimal number, where Sunday is 0 (range [0-6]) tm_wday
Ow parses weekday as a decimal number, where Sunday is 0, using the alternative numeric system, e.g. 二 parses as 2 in ja_JP locale tm_wday
Hour, minute, second
H parses the hour as a decimal number, 24 hour clock (range [00-23]), leading zeroes permitted but not required tm_hour
OH parses hour from 24-hour clock using the alternative numeric system, e.g. 十八 parses as 18 in ja_JP locale tm_hour
I parses hour as a decimal number, 12 hour clock (range [01,12]), leading zeroes permitted but not required tm_hour
OI parses hour from 12-hour clock using the alternative numeric system, e.g. 六 reads as 06 in ja_JP locale tm_hour
M parses minute as a decimal number (range [00,59]), leading zeroes permitted but not required tm_min
OM parses minute using the alternative numeric system, e.g. 二十五 parses as 25 in ja_JP locale tm_min
S parses second as a decimal number (range [00,60]), leading zeroes permitted but not required tm_sec
OS parses second using the alternative numeric system, e.g. 二十四 parses as 24 in ja_JP locale tm_sec
Other
c parses the locale's standard date and time string format, e.g. Sun Oct 17 04:41:13 2010 (locale dependent) all
Ec parses the locale's alternative date and time string format, e.g. expecting 平成23年 (year Heisei 23) instead of 2011年 (year 2011) in ja_JP locale all
x parses the locale's standard date representation all
Ex parses the locale's alternative date representation, e.g. expecting 平成23年 (year Heisei 23) instead of 2011年 (year 2011) in ja_JP locale all
X parses the locale's standard time representation all
EX parses the locale's alternative time representation all
D equivalent to "%m / %d / %y " tm_mon, tm_mday, tm_year
r parses locale's standard 12-hour clock time (in POSIX, "%I : %M : %S %p") tm_hour, tm_min, tm_sec
R equivalent to "%H : %M" tm_hour, tm_min
T equivalent to "%H : %M : %S" tm_hour, tm_min, tm_sec
p parses the locale's equivalent of a.m. or p.m. tm_hour
Original:
pointer to a null-terminated CharT string specifying the conversion format
La chaîne de format se compose de spécificateurs de conversion à zéro ou plusieurs caractères d'espacement, et des caractères ordinaires (à l'exception %). Chaque caractère ordinaire est censé correspondre à un caractère dans le flux d'entrée en comparaison insensible. Chaque caractère d'espacement correspond arbitraire espaces dans la chaîne d'entrée. Chaque spécification de conversion commence avec le caractère %, éventuellement suivie d'E ou modificateur O (ignoré si non pris en charge par la locale), suivi par le caractère qui détermine le comportement du prescripteur. Les spécificateurs de format correspondent à la fonction POSIX strptime():
Original:
The format string consists of zero or more conversion specifiers, whitespace characters, and ordinary characters (except %). Each ordinary character is expected to match one character in the input stream in case-insensitive comparison. Each whitespace character matches arbitrary whitespace in the input string. 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 format specifiers match the POSIX function strptime():
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Conversion
specifier
Explanation Writes to fields
% matches a literal %. The full conversion specification must be %%. (none)
t matches any whitespace. (none)
n matches any whitespace. (none)
Year
Y parses full year as a 4 digit decimal number, leading zeroes permitted but not required tm_year
EY parses year in the alternative representation, e.g.平成23年 (year Heisei 23) which writes 2011 to tm_year in ja_JP locale tm_year
y parses last 2 digits of year as a decimal number. Range [69,99] results in values 1969 to 1999, range [00,68] results in 2000-2068 tm_year
Oy parses last 2 digits of year using the alternative numeric system, e.g. 十一 is parsed as 11 in ja_JP locale tm_year
Ey parses year as offset from locale's alternative calendar period %EC tm_year
C parses the first 2 digits of year as a decimal number (range [00,99]) tm_year
EC parses the name of the base year (period) in the locale's alternative representation, e.g. 平成 (Heisei era) in ja_JP tm_year
Month
b parses the month name, either full or abbreviated, e.g. Oct tm_mon
h synonym of b tm_mon
B synonym of b tm_mon
m parses the month as a decimal number (range [01,12]), leading zeroes permitted but not required tm_mon
Om parses the month using the alternative numeric system, e.g. 十二 parses as 12 in ja_JP locale tm_mon
Week
U parses the week of the year as a decimal number (Sunday is the first day of the week) (range [00,53]), leading zeroes permitted but not required tm_year, tm_wday, tm_yday
OU parses the week of the year, as by %U, using the alternative numeric system, e.g. 五十二 parses as 52 in ja_JP locale tm_year, tm_wday, tm_yday
W parses the week of the year as a decimal number (Monday is the first day of the week) (range [00,53]), leading zeroes permitted but not required tm_year, tm_wday, tm_yday
OW parses the week of the year, as by %W, using the alternative numeric system, e.g. 五十二 parses as 52 in ja_JP locale tm_year, tm_wday, tm_yday
Day of the year/month
j parses day of the year as a decimal number (range [001,366]), leading zeroes permitted but not required tm_yday
d parses the day of the month as a decimal number (range [01,31]), leading zeroes permitted but not required tm_mday
Od parses the day of the month using the alternative numeric system, e.g 二十七 parses as 23 in ja_JP locale, leading zeroes permitted but not required tm_mday
e synonym of d tm_mday
Oe synonym of Od tm_mday
Day of the week
a parses the name of the day of the week, either full or abbreviated, e.g. Fri tm_wday
A synonym of a tm_wday
w parses weekday as a decimal number, where Sunday is 0 (range [0-6]) tm_wday
Ow parses weekday as a decimal number, where Sunday is 0, using the alternative numeric system, e.g. 二 parses as 2 in ja_JP locale tm_wday
Hour, minute, second
H parses the hour as a decimal number, 24 hour clock (range [00-23]), leading zeroes permitted but not required tm_hour
OH parses hour from 24-hour clock using the alternative numeric system, e.g. 十八 parses as 18 in ja_JP locale tm_hour
I parses hour as a decimal number, 12 hour clock (range [01,12]), leading zeroes permitted but not required tm_hour
OI parses hour from 12-hour clock using the alternative numeric system, e.g. 六 reads as 06 in ja_JP locale tm_hour
M parses minute as a decimal number (range [00,59]), leading zeroes permitted but not required tm_min
OM parses minute using the alternative numeric system, e.g. 二十五 parses as 25 in ja_JP locale tm_min
S parses second as a decimal number (range [00,60]), leading zeroes permitted but not required tm_sec
OS parses second using the alternative numeric system, e.g. 二十四 parses as 24 in ja_JP locale tm_sec
Other
c parses the locale's standard date and time string format, e.g. Sun Oct 17 04:41:13 2010 (locale dependent) all
Ec parses the locale's alternative date and time string format, e.g. expecting 平成23年 (year Heisei 23) instead of 2011年 (year 2011) in ja_JP locale all
x parses the locale's standard date representation all
Ex parses the locale's alternative date representation, e.g. expecting 平成23年 (year Heisei 23) instead of 2011年 (year 2011) in ja_JP locale all
X parses the locale's standard time representation all
EX parses the locale's alternative time representation all
D equivalent to "%m / %d / %y " tm_mon, tm_mday, tm_year
r parses locale's standard 12-hour clock time (in POSIX, "%I : %M : %S %p") tm_hour, tm_min, tm_sec
R equivalent to "%H : %M" tm_hour, tm_min
T equivalent to "%H : %M : %S" tm_hour, tm_min, tm_sec
p parses the locale's equivalent of a.m. or p.m. tm_hour
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifier] Retourne la valeur

Retourne un objet de type non précisé de sorte que si in est le nom d'un flux d'entrée de std::basic_istream<CharT, Traits> type, le in >> get_time(tmb, fmt) expression se comporte comme si le code suivant est exécuté:
Original:
Returns an object of unspecified type such that if in is the name of an input stream of type std::basic_istream<CharT, Traits>, then the expression in >> get_time(tmb, fmt) behaves as if the following code was executed:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

typedef std::istreambuf_iterator<CharT, Traits> Iter;
typedef std::time_get<CharT, Iter> TimeGet;
std::ios_base::iostate err = std::ios_base::goodbit;
const TimeGet& tg = std::use_facet<TimeGet>(in.getloc());
tg.get(Iter(in.rdbuf()), Iter(), in, err, tmb, fmt, fmt + traits::length(fmt));
if (err != std::ios_base::goodbit)
    in.setstate(err):


[modifier] Exemple

#include <iostream>
#include <sstream>
#include <locale>
#include <iomanip>
#include <ctime>
 
int main()
{
    std::tm t;
    std::istringstream ss("2011-Februar-18 23:12:34");
    ss.imbue(std::locale("de_DE"));
    ss >> std::get_time(&t, "%Y-%b-%d %H:%M:%S");
    std::cout << std::put_time(&t, "%c") << '\n';
}

Résultat :

Sun Feb 18 23:12:34 2011

[modifier] Voir aussi

analyse temps / valeur à la date d'une séquence de caractères d'entrée en struct std::tm
Original:
parses time/date values from an input character sequence into struct std::tm
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe générique) [edit]
(C++11)
formats et émet une valeur de date / heure selon le format spécifié
Original:
formats and outputs a date/time value according to the specified format
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction générique) [edit]