Espacios de nombres
Variantes
Acciones

std::get_time

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

 
 
Entrada / salida de la biblioteca
I / O manipuladores
C-estilo I / O
Buffers
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(obsoleto)
Arroyos
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Abstracciones
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
File I / 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
Cadena de 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
Matriz 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(obsoleto)
ostrstream(obsoleto)
strstream(obsoleto)
Tipos
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
Error interfaz categoría
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)
 
Entrada / salida manipuladores
De punto flotante de formato
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.
Formato Integer
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.
Formato booleano
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
Ancho de campo y de control de llenado
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.
Otros formatos
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.
Los espacios en blanco de procesamiento
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.
Salida de lavado
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.
Indicadores de estado manipulación
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.
Tiempo y dinero 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);
(desde C++11)
Cuando se utiliza en una expresión in >> get_time(tmb, fmt), analiza la entrada de caracteres como un valor de fecha / hora según la cadena de formato fmt de acuerdo con la faceta std::time_get de la configuración regional seleccionada imbuido en la out flujo de salida. El valor resultante se almacena en un objeto std::tm apuntado por 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.

Contenido

[editar] Parámetros

tmb -
puntero válido para el objeto std :: tm en la que se almacenará el resultado
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 -
puntero a una cadena terminada en cero la gráfica que especifica el formato de conversión
La cadena de formato se compone de cero o más especificadores de conversión, los espacios en blanco y caracteres ordinarios (excepto %). Cada carácter ordinario se espera que coincida con un carácter en el flujo de entrada en mayúsculas y minúsculas comparación. Cada espacio en blanco espacio en blanco coincide arbitrario en la cadena de entrada. Cada especificación de conversión comienza con carácter %, seguido opcionalmente por E o modificador O (se ignora si no soportado por el entorno local), seguido por el carácter que determina el comportamiento del especificador. Los especificadores de formato que coincida con la función 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 cadena de formato se compone de cero o más especificadores de conversión, los espacios en blanco y caracteres ordinarios (excepto %). Cada carácter ordinario se espera que coincida con un carácter en el flujo de entrada en mayúsculas y minúsculas comparación. Cada espacio en blanco espacio en blanco coincide arbitrario en la cadena de entrada. Cada especificación de conversión comienza con carácter %, seguido opcionalmente por E o modificador O (se ignora si no soportado por el entorno local), seguido por el carácter que determina el comportamiento del especificador. Los especificadores de formato que coincida con la función 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.

[editar] Valor de retorno

Devuelve un objeto de tipo no especificado de tal manera que si in es el nombre de un flujo de entrada de std::basic_istream<CharT, Traits> tipo, entonces la expresión in >> get_time(tmb, fmt) comporta como si el código se ha ejecutado:
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):


[editar] Ejemplo

#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';
}

Output:

Sun Feb 18 23:12:34 2011

[editar] Ver también

analiza hora / fecha valores de una secuencia de caracteres de entrada 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.

(clase de plantilla) [edit]
(C++11)
formatos y las salidas un valor de fecha / tiempo de acuerdo con el formato especificado
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.

(función de plantilla) [edit]