.\" -*- coding: UTF-8 -*- .\" Copyright 1993 Mitchum DSouza .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" Modified, jmv@lucifer.dorms.spbu.ru, 1999-11-08 .\" Modified, aeb, 2000-04-07 .\" Updated from glibc docs, C. Scott Ananian, 2001-08-25 .\" Modified, aeb, 2001-08-31 .\" Modified, wharms 2001-11-12, remark on white space and example .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH STRPTIME 3 "1 Noviembre 2020" GNU "Manual del Programador de Linux" .SH NOMBRE strptime \- convierte una cadena de caracteres que representa un tiempo a una estructura tm .SH SINOPSIS \fB#define _XOPEN_SOURCE\fP /* Vea feature_test_macros(7) */ .br \fB#include \fP .PP \fBchar *strptime(const char *\fP\fIs\fP\fB, const char *\fP\fIformat\fP\fB,\fP \fBstruct tm *\fP\fItm\fP\fB);\fP .SH DESCRIPCIÓN The \fBstrptime\fP() function is the converse of \fBstrftime\fP(3); it converts the character string pointed to by \fIs\fP to values which are stored in the "broken\-down time" structure pointed to by \fItm\fP, using the format specified by \fIformat\fP. .PP La estructura de tiempo descompuesto \fItm\fP se define en \fI\fP como sigue: .PP .in +4n .EX struct tm { int tm_sec; /* Seconds (0\-60) */ int tm_min; /* Minutes (0\-59) */ int tm_hour; /* Hours (0\-23) */ int tm_mday; /* Day of the month (1\-31) */ int tm_mon; /* Month (0\-11) */ int tm_year; /* Year \- 1900 */ int tm_wday; /* Day of the week (0\-6, Sunday = 0) */ int tm_yday; /* Day in the year (0\-365, 1 Jan = 0) */ int tm_isdst; /* Daylight saving time */ }; .EE .in .PP For more details on the \fItm\fP structure, see \fBctime\fP(3). .PP The \fIformat\fP argument is a character string that consists of field descriptors and text characters, reminiscent of \fBscanf\fP(3). Each field descriptor consists of a \fB%\fP character followed by another character that specifies the replacement for the field descriptor. All other characters in the \fIformat\fP string must have a matching character in the input string, except for whitespace, which matches zero or more whitespace characters in the input string. There should be white\%space or other alphanumeric characters between any two field descriptors. .PP La función \fBstrptime\fP() procesa la cadena de entrada de izquierda a derecha. Cada uno de los tres posibles elementos de entrada (espacio en blanco, literal o formato) se tratan uno detrás de otro. Si no se puede hacer coincidir la entrada con la cadena de formato, la función se detiene. El resto de las cadenas de formato y de entrada no se procesa. .PP The supported input field descriptors are listed below. In case a text string (such as the name of a day of the week or a month name) is to be matched, the comparison is case insensitive. In case a number is to be matched, leading zeros are permitted but not required. .TP \fB%%\fP El carácter \fB%\fP. .TP \fB%a\fP o \fB%A\fP The name of the day of the week according to the current locale, in abbreviated form or the full name. .TP \fB%b\fP o \fB%B\fP o \fB%h\fP El nombre del mes según la localización actual, en forma abreviada o completa. .TP \fB%c\fP La representación de fecha y hora para la localización actual. .TP \fB%C\fP El número de siglo (0\(en99). .TP \fB%d\fP o \fB%e\fP El día del mes (1\(en31). .TP \fB%D\fP Equivalent to \fB%m/%d/%y\fP. (This is the American style date, very confusing to non\-Americans, especially since \fB%d/%m/%y\fP is widely used in Europe. The ISO 8601 standard format is \fB%Y\-%m\-%d\fP.) .TP \fB%H\fP La hora (0\(en23). .TP \fB%I\fP La hora en formato de 12 horas (1\(en12). .TP \fB%j\fP El número de día del año (1\(en366). .TP \fB%m\fP El número de mes (1\(en12). .TP \fB%M\fP El minuto (0\(en59). .TP \fB%n\fP Cadena arbitraria de espacios en blanco. .TP \fB%p\fP El equivalente de AM o PM en la localización. (Nota: puede no existir.) .TP \fB%r\fP The 12\-hour clock time (using the locale's AM or PM). In the POSIX locale equivalent to \fB%I:%M:%S %p\fP. If \fIt_fmt_ampm\fP is empty in the \fBLC_TIME\fP part of the current locale, then the behavior is undefined. .TP \fB%R\fP Equivalente a \fB%H:%M\fP. .TP \fB%S\fP El segundo (0\(en60; 60 puede darse para segundos de salto (leap seconds); anteriormente también se permitía 61). .TP \fB%t\fP Cadena arbitraria de espacios en blanco. .TP \fB%T\fP Equivalente a \fB%H:%M:%S\fP. .TP \fB%U\fP El número de semana tomando el domingo como primer día de la semana (0\(en53). El primer domingo de enero es el primer día de la semana 1. .TP \fB%w\fP The ordinal number of the day of the week (0\(en6), with Sunday = 0. .TP \fB%W\fP El número de semana tomando el lunes como primer día de la semana (0\(en53). El primer lunes de enero es el primer día de la semana 1. .TP \fB%x\fP La fecha, usando el formato de fecha de la localización. .TP \fB%X\fP La hora, usando el formato de hora de la localización. .TP \fB%y\fP El año dentro del siglo (0\(en99). Cuando no se especifica el siglo, los valores comprendidos en el rango 69\(en99 se refieren al siglo 20 (1969\(en1999) y los valores comprendidos en el rango 00\(en68 se refieren al siglo 21 (2000\(en2068). .TP \fB%Y\fP El año, incluyendo el siglo (por ejemplo, 1991). .PP Algunos descriptores de campo pueden ser modificados por los caracteres modificadores E u O para indicar el uso de un formato o especificación alternativo. Si el formato o especificación alternativo no existe en la localización actual, se utiliza el descriptor de campo sin modificar. .PP El modificador E especifica que la cadena de entrada puede contener versiones alternativas de la representación de fecha y hora dependientes de la localización: .TP \fB%Ec\fP La representación alternativa de fecha y hora de la localización. .TP \fB%EC\fP El nombre del año base (período) en la representación alternativa de la localización. .TP \fB%Ex\fP La representación alternativa de fecha de la localización. .TP \fB%EX\fP La representación alternativa de hora de la localización. .TP \fB%Ey\fP El desplazamiento desde \fB%EC\fP (sólo año) en la representación alternativa de la localización. .TP \fB%EY\fP La representación alternativa completa para el año. .PP El modificador O especifica que la entrada numérica puede estar en un formato alternativo dependiente de la localización: .TP \fB%Od\fP o \fB%Oe\fP El día del mes usando los símbolos numéricos alternativos de la localización; los ceros del comienzo están permitidos pero no son obligatorios. .TP \fB%OH\fP La hora (foramto 24 horas) usando los símbolos numéricos alternativos de la localización. .TP \fB%OI\fP La hora (foramto 12 horas) usando los símbolos numéricos alternativos de la localización. .TP \fB%Om\fP El mes usando los símbolos numéricos alternativos de la localización. .TP \fB%OM\fP Los minutos usando los símbolos numéricos alternativos de la localización. .TP \fB%OS\fP Los segundos usando los símbolos numéricos alternativos de la localización. .TP \fB%OU\fP El número de semana del año (tomando el domingo como primer día de la semana) usando los símbolos numéricos alternativos de la localización. .TP \fB%Ow\fP The ordinal number of the day of the week (Sunday=0), using the locale's alternative numeric symbols. .TP \fB%OW\fP El número de semana del año (tomando el lunes como primer día de la semana) usando los símbolos numéricos alternativos de la localización. .TP \fB%Oy\fP El año (desplazamiento desde \fB%C\fP) usando los símbolos numéricos alternativos de la localización. .SH "VALOR DEVUELTO" The return value of the function is a pointer to the first character not processed in this function call. In case the input string contains more characters than required by the format string, the return value points right after the last consumed input character. In case the whole input string is consumed, the return value points to the null byte at the end of the string. If \fBstrptime\fP() fails to match all of the format string and therefore an error occurred, the function returns NULL. .SH ATRIBUTOS Para obtener una explicación de los términos usados en esta sección, véase \fBattributes\fP(7). .TS allbox; lb lb lb l l l. Interfaz Atributo Valor T{ \fBstrptime\fP() T} Seguridad del hilo MT\-Safe env locale .TE .SH "CONFORME A" POSIX.1\-2001, POSIX.1\-2008, SUSv2. .SH NOTAS .\" .PP .\" This function is available since libc 4.6.8. .\" Linux libc4 and libc5 includes define the prototype unconditionally; .\" glibc2 includes provide a prototype only when .\" .B _XOPEN_SOURCE .\" or .\" .B _GNU_SOURCE .\" are defined. .\" .PP .\" Before libc 5.4.13 whitespace .\" (and the \(aqn\(aq and \(aqt\(aq specifications) was not handled, .\" no \(aqE\(aq and \(aqO\(aq locale modifier characters were accepted, .\" and the \(aqC\(aq specification was a synonym for the \(aqc\(aq specification. In principle, this function does not initialize \fItm\fP but stores only the values specified. This means that \fItm\fP should be initialized before the call. Details differ a bit between different UNIX systems. The glibc implementation does not touch those fields which are not explicitly specified, except that it recomputes the \fItm_wday\fP and \fItm_yday\fP field if any of the year, month, or day elements changed. .PP .\" in the 20th century by libc4 and libc5. .\" It is taken to be a year .\" In libc4 and libc5 the code for %I is broken (fixed in glibc; .\" %OI was fixed in glibc 2.2.4). The \(aqy\(aq (year in century) specification is taken to specify a year in the range 1950\(en2049 by glibc 2.0. It is taken to be a year in 1969\(en2068 since glibc 2.1. .SS "Notas de glibc" Por razones de simetría, glibc trata de dar soporte en \fBstrptime\fP() a los mismos caracteres de formato que para \fBstrftime\fP(3). (En la mayoría de casos se analizan los campos correspondientes, pero no se modifica ningún campo de la estructura \fItm\fP.) Esto conduce a .TP \fB%F\fP Equivalente a \fB%Y\-%m\-%d\fP, el formato de fecha de ISO 8601. .TP \fB%g\fP El año correspondiente al número de semana ISO, pero sin el siglo (0\(en99). .TP \fB%G\fP El año correspondiente al número de semana ISO. (Por ejemplo, 1991.) .TP \fB%u\fP El día de la semana como un número decimal (1\(en7, donde lunes = 1). .TP \fB%V\fP El número de semana ISO 8601:1988 como un número decimal (1\(en53). Si la semana (comenzando en lunes) que contiene el 1 de enero tiene cuatro o más días en el nuevo año, se considera la semana 1. En otro caso, se toma como la última semana del año anterior y la siguiente semana pasa a ser la semana 1. .TP \fB%z\fP Una especificación estándar RFC\-822/ISO 8601 de huso horario. .TP \fB%Z\fP El nombre del huso horario. .PP Similarly, because of GNU extensions to \fBstrftime\fP(3), \fB%k\fP is accepted as a synonym for \fB%H\fP, and \fB%l\fP should be accepted as a synonym for \fB%I\fP, and \fB%P\fP is accepted as a synonym for \fB%p\fP. Finally .TP \fB%s\fP The number of seconds since the Epoch, 1970\-01\-01 00:00:00 +0000 (UTC). Leap seconds are not counted unless leap second support is available. .PP The glibc implementation does not require whitespace between two field descriptors. .SH EJEMPLOS El siguiente ejemplo demuestra el uso de \fBstrptime\fP() y \fBstrftime\fP(3). .PP .EX #define _XOPEN_SOURCE #include #include #include #include int main(void) { struct tm tm; char buf[255]; memset(&tm, 0, sizeof(tm)); strptime("2001\-11\-12 18:31:01", "%Y\-%m\-%d %H:%M:%S", &tm); strftime(buf, sizeof(buf), "%d %b %Y %H:%M", &tm); puts(buf); exit(EXIT_SUCCESS); } .EE .SH "VÉASE TAMBIÉN" \fBtime\fP(2), \fBgetdate\fP(3), \fBscanf\fP(3), \fBsetlocale\fP(3), \fBstrftime\fP(3) .SH COLOFÓN Esta página es parte de la versión 5.10 del proyecto Linux \fIman\-pages\fP. Puede encontrar una descripción del proyecto, información sobre cómo informar errores y la última versión de esta página en \%https://www.kernel.org/doc/man\-pages/. .PP .SH TRADUCCIÓN La traducción al español de esta página del manual fue creada por Gerardo Aburruzaga García , Juan Piernas y Miguel Pérez Ibars . .PP Esta traducción es documentación libre; lea la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 .UE o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD. .PP Si encuentra algún error en la traducción de esta página del manual, envíe un correo electrónico a .MT debian-l10n-spanish@lists.debian.org .ME .