Espaços nominais
Variantes
Acções

std::wcsftime

Da cppreference.com
< cpp‎ | chrono‎ | c

 
 
Biblioteca de utilitários
Digite apoio (basic types, RTTI, type traits)
Gerenciamento de memória dinâmica
De tratamento de erros
Utilidades do programa
Variadic funções
Data e hora
Objetos de função
initializer_list(C++11)
bitset
hash(C++11)
Os operadores relacionais
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
Pares e tuplas
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pair
tuple(C++11)
piecewise_construct_t(C++11)
piecewise_construct(C++11)
Troque, avançar e avançar
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
swap
forward(C++11)
move(C++11)
move_if_noexcept(C++11)
declval(C++11)
 
 
C estilo de utilitários de data e hora
Funções
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Manipulação do tempo
Original:
Time manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
difftime
time
clock
Conversões de formato
Original:
Format conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
asctime
ctime
strftime
wcsftime
gmtime
localtime
mktime
Constantes
Original:
Constants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
CLOCKS_PER_SEC
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.
tm
time_t
clock_t
 
Defined in header <cwchar>
std::size_t wcsftime( wchar_t* str, std::size_t count, const wchar_t* format, std::tm* time );
Converte a data e as informações de tempo de um calendário time dado tempo para uma cadeia de caracteres terminada em nulo ampla str acordo com format seqüência de formato. Até count bytes são escritos.
Original:
Converts the date and time information from a given calendar time time to a null-terminated wide character string str according to format string format. Up to count bytes are written.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Índice

[editar] Parâmetros

str -
ponteiro para o primeiro elemento da matriz wchar_t para saída
Original:
pointer to the first element of the wchar_t array for output
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
count -
número máximo de caracteres largos para escrever
Original:
maximum number of wide characters to write
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
format -
ponteiro para uma cadeia de caracteres terminada em nulo ampla especificando o formato de conversão.
A cadeia de formato consiste de zero ou mais especificadores de conversão e caracteres normais (exceto %). Todos os personagens comuns, incluindo o caractere nulo de terminação, são copiados para a cadeia de saída, sem modificação. Cada especificação de conversão começa com o personagem %, opcionalmente seguido por E ou O modificador (ignorado se não suportado pelo local), seguido pelo caráter que determina o comportamento do especificador. Os especificadores de formato disponíveis são:
Original:
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:
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 Used fields
% writes literal %. The full conversion specification must be %%.
n(C++11) writes newline character
t(C++11) writes horizontal tab character
Year
Y writes year as a 4 digit decimal number tm_year
EY(C++11) writes year in the alternative representation, e.g.平成23年 (year Heisei 23) instead of 2011年 (year 2011) in ja_JP locale tm_year
y writes last 2 digits of year as a decimal number (range [00,99]) tm_year
Oy(C++11) writes last 2 digits of year using the alternative numeric system, e.g. 十一 instead of 11 in ja_JP locale tm_year
Ey(C++11) writes year as offset from locale's alternative calendar period %EC (locale-dependent) tm_year
C(C++11) writes first 2 digits of year as a decimal number (range [00,99]) tm_year
EC(C++11) writes name of the base year (period) in the locale's alternative representation, e.g. 平成 (Heisei era) in ja_JP tm_year
G(C++11) writes ISO 8601 week-based year, i.e. the year that contains the specified week.
Em IS0 8601 semana começa com segunda-feira e na primeira semana do ano deve satisfazer os seguintes requisitos:
Original:
In IS0 8601 weeks begin with Monday and the first week of the year must satisfy the following requirements:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • Inclui 4 de janeiro
    Original:
    Includes January 4
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Inclui primeira quinta-feira do ano
    Original:
    Includes first Thursday of the year
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
tm_year, tm_wday, tm_yday
g(C++11) writes last 2 digits of ISO 8601 week-based year, i.e. the year that contains the specified week (range [00,99]).
Em IS0 8601 semana começa com segunda-feira e na primeira semana do ano deve satisfazer os seguintes requisitos:
Original:
In IS0 8601 weeks begin with Monday and the first week of the year must satisfy the following requirements:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • Inclui 4 de janeiro
    Original:
    Includes January 4
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Inclui primeira quinta-feira do ano
    Original:
    Includes first Thursday of the year
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
tm_year, tm_wday, tm_yday
Month
b writes abbreviated month name, e.g. Oct (locale dependent) tm_mon
h(C++11) synonym of 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(C++11) writes month using the alternative numeric system, e.g. 十二 instead of 12 in ja_JP locale 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(C++11) writes week of the year, as by %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(C++11) writes week of the year, as by %W, using the alternative numeric system, e.g. 五十二 instead of 52 in ja_JP locale tm_year, tm_wday, tm_yday
V(C++11) writes ISO 8601 week of the year (range [01,53]).
Em IS0 8601 semana começa com segunda-feira e na primeira semana do ano deve satisfazer os seguintes requisitos:
Original:
In IS0 8601 weeks begin with Monday and the first week of the year must satisfy the following requirements:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • Inclui 4 de janeiro
    Original:
    Includes January 4
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Inclui primeira quinta-feira do ano
    Original:
    Includes first Thursday of the year
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
tm_year, tm_wday, tm_yday
OV(C++11) writes week of the year, as by %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(C++11) writes zero-based day of the month using the alternative numeric system, e.g 二十七 instead of 23 in ja_JP locale
Único caractere é precedido por um espaço.
Original:
Single character is preceded by a space.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
tm_mday
e(C++11) writes day of the month as a decimal number (range [1,31]).
Único dígito é precedido por um espaço.
Original:
Single digit is preceded by a space.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
tm_mday
Oe(C++11) writes one-based day of the month using the alternative numeric system, e.g. 二十七 instead of 27 in ja_JP locale
Único caractere é precedido por um espaço.
Original:
Single character is preceded by a space.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
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(C++11) writes weekday, where Sunday is 0, using the alternative numeric system, e.g. 二 instead of 2 in ja_JP locale tm_wday
u(C++11) writes weekday as a decimal number, where Monday is 1 (ISO 8601 format) (range [1-7]) tm_wday
Ou(C++11) writes weekday, where Monday is 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(C++11) writes hour from 24-hour clock using the alternative numeric system, e.g. 十八 instead of 18 in ja_JP locale tm_hour
I writes hour as a decimal number, 12 hour clock (range [01,12]) tm_hour
OI(C++11) writes hour from 12-hour clock using the alternative numeric system, e.g. 六 instead of 06 in ja_JP locale tm_hour
M writes minute as a decimal number (range [00,59]) tm_min
OM(C++11) writes minute using the alternative numeric system, e.g. 二十五 instead of 25 in ja_JP locale tm_min
S writes second as a decimal number (range [00,60]) tm_sec
OS(C++11) writes second using the alternative numeric system, e.g. 二十四 instead of 24 in ja_JP locale tm_sec
Other
c writes standard date and time string, e.g. Sun Oct 17 04:41:13 2010 (locale dependent) all
Ec(C++11) writes alternative date and time string, e.g. using 平成23年 (year Heisei 23) instead of 2011年 (year 2011) in ja_JP locale all
x writes localized date representation (locale dependent) all
Ex(C++11) writes alternative date representation, e.g. using 平成23年 (year Heisei 23) instead of 2011年 (year 2011) in ja_JP locale all
X writes localized time representation (locale dependent) all
EX(C++11) writes alternative time representation (locale dependent) all
D(C++11) equivalent to "%m/%d/%y" tm_mon, tm_mday, tm_year
F(C++11) equivalent to "%Y-%m-%d" (the ISO 8601 date format) tm_mon, tm_mday, tm_year
r(C++11) writes localized 12-hour clock time (locale dependent) tm_hour, tm_min, tm_sec
R(C++11) equivalent to "%H:%M" tm_hour, tm_min
T(C++11) equivalent to "%H:%M:%S" (the ISO 8601 time format) tm_hour, tm_min, tm_sec
p writes localized a.m. or p.m. (locale dependent) tm_hour
z(C++11) writes offset from UTC in the ISO 8601 format (e.g. -0430), or no characters if the time zone information is not available tm_isdst
Z writes time zone name or abbreviation, or no characters if the time zone information is not available (locale dependent) tm_isdst
Original:
pointer to a null-terminated wide character string specifying the format of conversion.
A cadeia de formato consiste de zero ou mais especificadores de conversão e caracteres normais (exceto %). Todos os personagens comuns, incluindo o caractere nulo de terminação, são copiados para a cadeia de saída, sem modificação. Cada especificação de conversão começa com o personagem %, opcionalmente seguido por E ou O modificador (ignorado se não suportado pelo local), seguido pelo caráter que determina o comportamento do especificador. Os especificadores de formato disponíveis são:
Original:
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:
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 Used fields
% writes literal %. The full conversion specification must be %%.
n(C++11) writes newline character
t(C++11) writes horizontal tab character
Year
Y writes year as a 4 digit decimal number tm_year
EY(C++11) writes year in the alternative representation, e.g.平成23年 (year Heisei 23) instead of 2011年 (year 2011) in ja_JP locale tm_year
y writes last 2 digits of year as a decimal number (range [00,99]) tm_year
Oy(C++11) writes last 2 digits of year using the alternative numeric system, e.g. 十一 instead of 11 in ja_JP locale tm_year
Ey(C++11) writes year as offset from locale's alternative calendar period %EC (locale-dependent) tm_year
C(C++11) writes first 2 digits of year as a decimal number (range [00,99]) tm_year
EC(C++11) writes name of the base year (period) in the locale's alternative representation, e.g. 平成 (Heisei era) in ja_JP tm_year
G(C++11) writes ISO 8601 week-based year, i.e. the year that contains the specified week.
Em IS0 8601 semana começa com segunda-feira e na primeira semana do ano deve satisfazer os seguintes requisitos:
Original:
In IS0 8601 weeks begin with Monday and the first week of the year must satisfy the following requirements:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • Inclui 4 de janeiro
    Original:
    Includes January 4
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Inclui primeira quinta-feira do ano
    Original:
    Includes first Thursday of the year
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
tm_year, tm_wday, tm_yday
g(C++11) writes last 2 digits of ISO 8601 week-based year, i.e. the year that contains the specified week (range [00,99]).
Em IS0 8601 semana começa com segunda-feira e na primeira semana do ano deve satisfazer os seguintes requisitos:
Original:
In IS0 8601 weeks begin with Monday and the first week of the year must satisfy the following requirements:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • Inclui 4 de janeiro
    Original:
    Includes January 4
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Inclui primeira quinta-feira do ano
    Original:
    Includes first Thursday of the year
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
tm_year, tm_wday, tm_yday
Month
b writes abbreviated month name, e.g. Oct (locale dependent) tm_mon
h(C++11) synonym of 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(C++11) writes month using the alternative numeric system, e.g. 十二 instead of 12 in ja_JP locale 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(C++11) writes week of the year, as by %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(C++11) writes week of the year, as by %W, using the alternative numeric system, e.g. 五十二 instead of 52 in ja_JP locale tm_year, tm_wday, tm_yday
V(C++11) writes ISO 8601 week of the year (range [01,53]).
Em IS0 8601 semana começa com segunda-feira e na primeira semana do ano deve satisfazer os seguintes requisitos:
Original:
In IS0 8601 weeks begin with Monday and the first week of the year must satisfy the following requirements:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • Inclui 4 de janeiro
    Original:
    Includes January 4
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Inclui primeira quinta-feira do ano
    Original:
    Includes first Thursday of the year
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
tm_year, tm_wday, tm_yday
OV(C++11) writes week of the year, as by %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(C++11) writes zero-based day of the month using the alternative numeric system, e.g 二十七 instead of 23 in ja_JP locale
Único caractere é precedido por um espaço.
Original:
Single character is preceded by a space.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
tm_mday
e(C++11) writes day of the month as a decimal number (range [1,31]).
Único dígito é precedido por um espaço.
Original:
Single digit is preceded by a space.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
tm_mday
Oe(C++11) writes one-based day of the month using the alternative numeric system, e.g. 二十七 instead of 27 in ja_JP locale
Único caractere é precedido por um espaço.
Original:
Single character is preceded by a space.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
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(C++11) writes weekday, where Sunday is 0, using the alternative numeric system, e.g. 二 instead of 2 in ja_JP locale tm_wday
u(C++11) writes weekday as a decimal number, where Monday is 1 (ISO 8601 format) (range [1-7]) tm_wday
Ou(C++11) writes weekday, where Monday is 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(C++11) writes hour from 24-hour clock using the alternative numeric system, e.g. 十八 instead of 18 in ja_JP locale tm_hour
I writes hour as a decimal number, 12 hour clock (range [01,12]) tm_hour
OI(C++11) writes hour from 12-hour clock using the alternative numeric system, e.g. 六 instead of 06 in ja_JP locale tm_hour
M writes minute as a decimal number (range [00,59]) tm_min
OM(C++11) writes minute using the alternative numeric system, e.g. 二十五 instead of 25 in ja_JP locale tm_min
S writes second as a decimal number (range [00,60]) tm_sec
OS(C++11) writes second using the alternative numeric system, e.g. 二十四 instead of 24 in ja_JP locale tm_sec
Other
c writes standard date and time string, e.g. Sun Oct 17 04:41:13 2010 (locale dependent) all
Ec(C++11) writes alternative date and time string, e.g. using 平成23年 (year Heisei 23) instead of 2011年 (year 2011) in ja_JP locale all
x writes localized date representation (locale dependent) all
Ex(C++11) writes alternative date representation, e.g. using 平成23年 (year Heisei 23) instead of 2011年 (year 2011) in ja_JP locale all
X writes localized time representation (locale dependent) all
EX(C++11) writes alternative time representation (locale dependent) all
D(C++11) equivalent to "%m/%d/%y" tm_mon, tm_mday, tm_year
F(C++11) equivalent to "%Y-%m-%d" (the ISO 8601 date format) tm_mon, tm_mday, tm_year
r(C++11) writes localized 12-hour clock time (locale dependent) tm_hour, tm_min, tm_sec
R(C++11) equivalent to "%H:%M" tm_hour, tm_min
T(C++11) equivalent to "%H:%M:%S" (the ISO 8601 time format) tm_hour, tm_min, tm_sec
p writes localized a.m. or p.m. (locale dependent) tm_hour
z(C++11) writes offset from UTC in the ISO 8601 format (e.g. -0430), or no characters if the time zone information is not available tm_isdst
Z writes time zone name or abbreviation, or no characters if the time zone information is not available (locale dependent) tm_isdst
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

Número de caracteres largos escritos na matriz de caracteres de largura apontado por str não incluindo o L'\0' terminação sucesso. Se count foi alcançado antes de toda a cadeia pode ser armazenado, 0 é devolvido e os conteúdos são indefinidos.
Original:
Number of wide characters written into the wide character array pointed to by str not including the terminating L'\0' on success. If count was reached before the entire string could be stored, 0 is returned and the contents are undefined.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Exemplo

#include <ctime>
#include <cwchar>
#include <iostream>
#include <locale>
 
int main()
{
    std::locale::global(std::locale("ja_JP.utf8"));
    std::time_t t = std::time(NULL);
    wchar_t wstr[100];
    if(std::wcsftime(wstr, 100, L"%A %c", std::localtime(&t))) {
        std::wcout << wstr << '\n';
    }
}

Output:

火曜日 2011年12月27日 17時43分13秒

[editar] Veja também

converte um objeto tm a representação textual personalizado
Original:
converts a tm object to custom textual representation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função) [edit]
(C++11)
formatos e saídas de um valor de data / hora de acordo com o 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.

(modelo de função) [edit]
C documentation for wcsftime