Espacios de nombres
Variantes
Acciones

std::asctime

De cppreference.com
< cpp‎ | chrono‎ | c
 
 
Biblioteca de servicios
 
 
Utilidades de fecha y hora estilo C
Funciones
Manipulación de tiempo
Conversiones de formato
asctime
Constantes
Tipos
(C++17)
 
Definido en el archivo de encabezado <ctime>
char* asctime( const std::tm* time_ptr );
Convierte dado std::tm calendario tiempo a una representación textual .
Original:
Converts given calendar time std::tm to a textual representation.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
La cadena resultante tiene el siguiente formato:
Original:
The resulting string has the following format:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Www Mmm dd hh:mm:ss yyyy
  • Www - el día de la semana (uno de Mon, Tue, Wed, Thu, Fri, Sat, Sun) .
    Original:
    Www - the day of the week (one of Mon, Tue, Wed, Thu, Fri, Sat, Sun).
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Mmm - el mes (una de Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec) .
    Original:
    Mmm - the month (one of Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec).
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • dd - el día del mes
    Original:
    dd - the day of the month
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • hh - horas
    Original:
    hh - hours
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • mm - minutos
    Original:
    mm - minutes
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • ss - segundos
    Original:
    ss - seconds
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • yyyy - años
    Original:
    yyyy - years
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
La función no es compatible con localización .
Original:
The function does not support localization.
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

time_ptr -
puntero a un objeto std::tm especificando el tiempo de imprimir
Original:
pointer to a std::tm object specifying the time to print
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

Puntero a una cadena de caracteres terminada en cero estático celebración de la representación textual de fecha y hora. La cadena puede ser compartida entre std::asctime y std::ctime, y puede ser sobreescrita en cada invocación de cualquiera de estas funciones .
Original:
Pointer to a static null-terminated character string holding the textual representation of date and time. The string may be shared between std::asctime and std::ctime, and may be overwritten on each invocation of any of those functions.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Notas

Esta función devuelve un puntero a datos estáticos y no es seguro para subprocesos. POSIX marca esta función obsoleta y recomienda std::strftime lugar .
Original:
This function returns a pointer to static data and is not thread-safe. POSIX marks this function obsolete and recommends std::strftime instead.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
El comportamiento no está definido si la cadena de producción sería superior a 25 caracteres, si timeptr->tm_wday o timeptr->tm_mon no están dentro de los rangos esperados, o si excede timeptr->tm_year INT_MAX-1990 .
Original:
The behavior is undefined if the output string would be longer than 25 characters, if timeptr->tm_wday or timeptr->tm_mon are not within the expected ranges, or if timeptr->tm_year exceeds INT_MAX-1990.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Algunas implementaciones de manejar timeptr->tm_mday==0 en el sentido del último día del mes anterior .
Original:
Some implementations handle timeptr->tm_mday==0 as meaning the last day of the preceding month.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Ejemplo

#include <ctime>
#include <iostream>
 
int main()
{
    std::time_t result = std::time(NULL);
    std::cout << std::asctime(std::localtime(&result));
}

Salida:

Tue Dec 27 16:45:52 2011

[editar] Ver también

Convierte un objeto time_t a una representación textual.
(función) [editar]
Convierte un objeto tm a una representación textual personalizada.
(función) [editar]
(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.

(plantilla de función) [editar]
Documentación de C para asctime