2004-11-03 13:51:07 +00:00
|
|
|
.\" Copyright 1993 Mitchum DSouza <m.dsouza@mrc-apu.cam.ac.uk>
|
|
|
|
.\"
|
|
|
|
.\" 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.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" 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.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
|
|
.\"
|
|
|
|
.\" 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
|
|
|
|
.\"
|
2009-12-05 05:49:17 +00:00
|
|
|
.TH STRPTIME 3 2009-12-05 "GNU" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
|
|
|
strptime \- convert a string representation of time to a time tm structure
|
|
|
|
.SH SYNOPSIS
|
getresuid.2, mremap.2, poll.2, remap_file_pages.2, setresuid.2, splice.2, sync_file_range.2, syscall.2, tee.2, vmsplice.2, INFINITY.3, aio_init.3, asprintf.3, assert_perror.3, basename.3, bsd_signal.3, canonicalize_file_name.3, clog10.3, crypt.3, dl_iterate_phdr.3, dlopen.3, encrypt.3, exp10.3, fcloseall.3, fenv.3, fopencookie.3, ftw.3, getaddrinfo_a.3, getloadavg.3, getutent.3, grantpt.3, hsearch.3, lseek64.3, memmem.3, mempcpy.3, pow10.3, program_invocation_name.3, ptsname.3, putgrent.3, sched_getcpu.3, sincos.3, strchr.3, strfry.3, strnlen.3, strptime.3, strstr.3, strverscmp.3, swab.3, sysv_signal.3, tsearch.3, unlockpt.3, wcwidth.3: Add reference to feature_test_macros(7)
Some pages simply list feature test macro requirements in
the form:
#define #GNU_SOURCE
#include <someheader.h>
For these pages, add a "See feature_test_macros(7)" comment
on the "#define" line.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-31 04:31:47 +00:00
|
|
|
.BR "#define _XOPEN_SOURCE" " /* See feature_test_macros(7) */"
|
2004-11-03 13:51:07 +00:00
|
|
|
.br
|
|
|
|
.B #include <time.h>
|
|
|
|
.sp
|
|
|
|
.BI "char *strptime(const char *" s ", const char *" format ,
|
|
|
|
.BI "struct tm *" tm );
|
|
|
|
.SH DESCRIPTION
|
|
|
|
The
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR strptime ()
|
2004-11-03 13:51:07 +00:00
|
|
|
function is the converse function to
|
2007-05-12 00:30:29 +00:00
|
|
|
.BR strftime (3)
|
2004-11-03 13:51:07 +00:00
|
|
|
and converts the character string pointed to by
|
|
|
|
.I s
|
|
|
|
to values which are stored in the
|
2007-06-23 07:56:56 +00:00
|
|
|
.I tm
|
2004-11-03 13:51:07 +00:00
|
|
|
structure pointed to by
|
|
|
|
.IR tm ,
|
|
|
|
using the format specified by
|
|
|
|
.IR format .
|
|
|
|
Here
|
|
|
|
.I format
|
|
|
|
is a character string that consists of field descriptors and text characters,
|
|
|
|
reminiscent of
|
|
|
|
.BR scanf (3).
|
|
|
|
Each field descriptor consists of a
|
|
|
|
.B %
|
|
|
|
character followed by another character that specifies the replacement
|
|
|
|
for the field descriptor.
|
2007-04-12 22:42:49 +00:00
|
|
|
All other characters in the
|
|
|
|
.I format
|
2004-11-03 13:51:07 +00:00
|
|
|
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
|
2007-05-12 09:06:04 +00:00
|
|
|
The
|
|
|
|
.BR strptime ()
|
|
|
|
function processes the input string from left
|
2007-04-12 22:42:49 +00:00
|
|
|
to right.
|
|
|
|
Each of the three possible input elements (whitespace,
|
|
|
|
literal, or format) are handled one after the other.
|
|
|
|
If the input cannot be matched to the format string the function stops.
|
|
|
|
The remainder of the format and input strings are not processed.
|
2004-11-03 13:51:07 +00:00
|
|
|
.PP
|
|
|
|
The supported input field descriptors are listed below.
|
|
|
|
In case a text string (such as a weekday or 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
|
|
|
|
.B %%
|
|
|
|
The
|
|
|
|
.B %
|
|
|
|
character.
|
|
|
|
.TP
|
|
|
|
.BR %a " or " %A
|
|
|
|
The weekday name according to the current locale,
|
|
|
|
in abbreviated form or the full name.
|
|
|
|
.TP
|
|
|
|
.BR %b " or " %B " or " %h
|
|
|
|
The month name according to the current locale,
|
|
|
|
in abbreviated form or the full name.
|
|
|
|
.TP
|
|
|
|
.B %c
|
|
|
|
The date and time representation for the current locale.
|
|
|
|
.TP
|
|
|
|
.B %C
|
|
|
|
The century number (0-99).
|
|
|
|
.TP
|
|
|
|
.BR %d " or " %e
|
|
|
|
The day of month (1-31).
|
|
|
|
.TP
|
|
|
|
.B %D
|
2007-07-09 21:02:59 +00:00
|
|
|
Equivalent to
|
|
|
|
.BR %m/%d/%y .
|
2007-04-12 22:42:49 +00:00
|
|
|
(This is the American style date, very confusing
|
2007-07-09 21:02:59 +00:00
|
|
|
to non-Americans, especially since
|
|
|
|
.B %d/%m/%y
|
|
|
|
is widely used in Europe.
|
|
|
|
The ISO 8601 standard format is
|
|
|
|
.BR %Y-%m-%d .)
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
2007-09-20 16:26:31 +00:00
|
|
|
.B %H
|
2004-11-03 13:51:07 +00:00
|
|
|
The hour (0-23).
|
|
|
|
.TP
|
2007-09-20 16:26:31 +00:00
|
|
|
.B %I
|
2004-11-03 13:51:07 +00:00
|
|
|
The hour on a 12-hour clock (1-12).
|
|
|
|
.TP
|
|
|
|
.B %j
|
|
|
|
The day number in the year (1-366).
|
|
|
|
.TP
|
|
|
|
.B %m
|
|
|
|
The month number (1-12).
|
|
|
|
.TP
|
|
|
|
.B %M
|
|
|
|
The minute (0-59).
|
|
|
|
.TP
|
|
|
|
.B %n
|
|
|
|
Arbitrary whitespace.
|
|
|
|
.TP
|
|
|
|
.B %p
|
2008-06-28 04:57:20 +00:00
|
|
|
The locale's equivalent of AM or PM.
|
|
|
|
(Note: there may be none.)
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B %r
|
|
|
|
The 12-hour clock time (using the locale's AM or PM).
|
2007-07-09 21:02:59 +00:00
|
|
|
In the POSIX locale equivalent to
|
|
|
|
.BR "%I:%M:%S %p" .
|
2007-06-22 20:40:07 +00:00
|
|
|
If \fIt_fmt_ampm\fP is empty in the
|
|
|
|
.B LC_TIME
|
|
|
|
part of the current locale
|
2007-06-08 09:56:56 +00:00
|
|
|
then the behavior is undefined.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B %R
|
2007-07-09 21:02:59 +00:00
|
|
|
Equivalent to
|
|
|
|
.BR %H:%M .
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B %S
|
2007-04-12 22:42:49 +00:00
|
|
|
The second (0-60; 60 may occur for leap seconds;
|
|
|
|
earlier also 61 was allowed).
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B %t
|
|
|
|
Arbitrary whitespace.
|
|
|
|
.TP
|
|
|
|
.B %T
|
2007-07-09 21:02:59 +00:00
|
|
|
Equivalent to
|
|
|
|
.BR %H:%M:%S .
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B %U
|
|
|
|
The week number with Sunday the first day of the week (0-53).
|
|
|
|
The first Sunday of January is the first day of week 1.
|
|
|
|
.TP
|
|
|
|
.B %w
|
|
|
|
The weekday number (0-6) with Sunday = 0.
|
|
|
|
.TP
|
|
|
|
.B %W
|
|
|
|
The week number with Monday the first day of the week (0-53).
|
|
|
|
The first Monday of January is the first day of week 1.
|
|
|
|
.TP
|
|
|
|
.B %x
|
|
|
|
The date, using the locale's date format.
|
|
|
|
.TP
|
|
|
|
.B %X
|
|
|
|
The time, using the locale's time format.
|
|
|
|
.TP
|
|
|
|
.B %y
|
|
|
|
The year within century (0-99).
|
|
|
|
When a century is not otherwise specified, values in the range 69-99 refer
|
|
|
|
to years in the twentieth century (1969-1999); values in the
|
|
|
|
range 00-68 refer to years in the twenty-first century (2000-2068).
|
|
|
|
.TP
|
|
|
|
.B %Y
|
|
|
|
The year, including century (for example, 1991).
|
|
|
|
.LP
|
|
|
|
Some field descriptors can be modified by the E or O modifier characters
|
2007-04-12 22:42:49 +00:00
|
|
|
to indicate that an alternative format or specification should be used.
|
|
|
|
If the
|
2004-11-03 13:51:07 +00:00
|
|
|
alternative format or specification does not exist in the current locale, the
|
|
|
|
unmodified field descriptor is used.
|
|
|
|
.LP
|
|
|
|
The E modifier specifies that the input string may contain
|
|
|
|
alternative locale-dependent versions of the date and time representation:
|
|
|
|
.TP
|
|
|
|
.B %Ec
|
|
|
|
The locale's alternative date and time representation.
|
|
|
|
.TP
|
|
|
|
.B %EC
|
|
|
|
The name of the base year (period) in the locale's alternative representation.
|
|
|
|
.TP
|
|
|
|
.B %Ex
|
|
|
|
The locale's alternative date representation.
|
|
|
|
.TP
|
|
|
|
.B %EX
|
|
|
|
The locale's alternative time representation.
|
|
|
|
.TP
|
|
|
|
.B %Ey
|
2007-07-09 21:02:59 +00:00
|
|
|
The offset from
|
|
|
|
.B %EC
|
|
|
|
(year only) in the locale's alternative representation.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B %EY
|
|
|
|
The full alternative year representation.
|
|
|
|
.LP
|
|
|
|
The O modifier specifies that the numerical input may be in an
|
|
|
|
alternative locale-dependent format:
|
|
|
|
.TP
|
|
|
|
.BR %Od " or " %Oe
|
|
|
|
The day of the month using the locale's alternative numeric symbols;
|
|
|
|
leading zeros are permitted but not required.
|
|
|
|
.TP
|
|
|
|
.B %OH
|
|
|
|
The hour (24-hour clock) using the locale's alternative numeric symbols.
|
|
|
|
.TP
|
|
|
|
.B %OI
|
|
|
|
The hour (12-hour clock) using the locale's alternative numeric symbols.
|
|
|
|
.TP
|
|
|
|
.B %Om
|
|
|
|
The month using the locale's alternative numeric symbols.
|
|
|
|
.TP
|
|
|
|
.B %OM
|
|
|
|
The minutes using the locale's alternative numeric symbols.
|
|
|
|
.TP
|
|
|
|
.B %OS
|
|
|
|
The seconds using the locale's alternative numeric symbols.
|
|
|
|
.TP
|
|
|
|
.B %OU
|
|
|
|
The week number of the year (Sunday as the first day of the week)
|
|
|
|
using the locale's alternative numeric symbols.
|
|
|
|
.TP
|
|
|
|
.B %Ow
|
|
|
|
The number of the weekday (Sunday=0) using the locale's alternative
|
|
|
|
numeric symbols.
|
|
|
|
.TP
|
|
|
|
.B %OW
|
|
|
|
The week number of the year (Monday as the first day of the week)
|
|
|
|
using the locale's alternative numeric symbols.
|
|
|
|
.TP
|
|
|
|
.B %Oy
|
2007-07-09 21:02:59 +00:00
|
|
|
The year (offset from
|
|
|
|
.BR %C )
|
|
|
|
using the locale's alternative numeric symbols.
|
2004-11-03 13:51:07 +00:00
|
|
|
.LP
|
|
|
|
The broken-down time structure \fItm\fP is defined in \fI<time.h>\fP
|
|
|
|
as follows:
|
|
|
|
.sp
|
2007-12-19 05:53:30 +00:00
|
|
|
.in +4n
|
2004-11-03 13:51:07 +00:00
|
|
|
.nf
|
|
|
|
struct tm {
|
2007-04-03 15:32:52 +00:00
|
|
|
int tm_sec; /* seconds */
|
|
|
|
int tm_min; /* minutes */
|
|
|
|
int tm_hour; /* hours */
|
|
|
|
int tm_mday; /* day of the month */
|
|
|
|
int tm_mon; /* month */
|
|
|
|
int tm_year; /* year */
|
|
|
|
int tm_wday; /* day of the week */
|
|
|
|
int tm_yday; /* day in the year */
|
|
|
|
int tm_isdst; /* daylight saving time */
|
2004-11-03 13:51:07 +00:00
|
|
|
};
|
|
|
|
.fi
|
2007-12-19 05:53:30 +00:00
|
|
|
.in
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "RETURN VALUE"
|
|
|
|
The return value of the function is a pointer to the first character
|
2007-04-12 22:42:49 +00:00
|
|
|
not processed in this function call.
|
|
|
|
In case the input string
|
2004-11-03 13:51:07 +00:00
|
|
|
contains more characters than required by the format string the return
|
2007-04-12 22:42:49 +00:00
|
|
|
value points right after the last consumed input character.
|
|
|
|
In case
|
2006-01-13 02:09:44 +00:00
|
|
|
the whole input string is consumed the return value points to the null
|
2007-04-12 22:42:49 +00:00
|
|
|
byte at the end of the string.
|
2007-05-12 09:06:04 +00:00
|
|
|
If
|
|
|
|
.BR strptime ()
|
|
|
|
fails to match all
|
2004-11-03 13:51:07 +00:00
|
|
|
of the format string and therefore an error occurred the function
|
2005-10-19 13:48:50 +00:00
|
|
|
returns NULL.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "CONFORMING TO"
|
2006-08-03 13:57:30 +00:00
|
|
|
SUSv2, POSIX.1-2001.
|
2007-05-18 10:30:02 +00:00
|
|
|
.SH NOTES
|
|
|
|
.LP
|
2007-12-13 20:46:52 +00:00
|
|
|
In principle, this function does not initialize \fItm\fP but
|
2007-05-18 10:30:02 +00:00
|
|
|
only stores the values specified.
|
2007-12-13 20:46:52 +00:00
|
|
|
This means that \fItm\fP should be initialized before the call.
|
intro.1, time.1, accept.2, bind.2, connect.2, execve.2, flock.2, getdents.2, getpriority.2, getuid.2, intro.2, ioctl.2, mincore.2, mknod.2, personality.2, ptrace.2, read.2, recv.2, select_tut.2, send.2, sendfile.2, shmctl.2, sigaction.2, signal.2, stat.2, times.2, truncate.2, umask.2, wait.2, MB_CUR_MAX.3, MB_LEN_MAX.3, argz_add.3, btowc.3, clearenv.3, clock.3, cmsg.3, end.3, endian.3, errno.3, exit.3, fgetwc.3, fgetws.3, fopen.3, fputwc.3, fputws.3, fseek.3, fwide.3, getfsent.3, getgrnam.3, gethostid.3, getipnodebyname.3, getmntent.3, getpwnam.3, getwchar.3, grantpt.3, iconv.3, iconv_close.3, iconv_open.3, insque.3, intro.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, malloc.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mkstemp.3, mktemp.3, nl_langinfo.3, openpty.3, posix_openpt.3, printf.3, ptsname.3, putwchar.3, qecvt.3, rcmd.3, readdir.3, rexec.3, rpc.3, setnetgrent.3, shm_open.3, sigpause.3, stdin.3, stpcpy.3, strftime.3, strptime.3, syslog.3, towctrans.3, towlower.3, towupper.3, ttyslot.3, ungetwc.3, unlocked_stdio.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wprintf.3, console_ioctl.4, pts.4, elf.5, filesystems.5, hosts.5, proc.5, ttytype.5, boot.7, capabilities.7, credentials.7, epoll.7, glob.7, koi8-r.7, path_resolution.7, pty.7, signal.7, suffixes.7, time.7, unicode.7, unix.7, uri.7, utf-8.7: global fix: s/Unix/UNIX/
The man pages were rather inconsistent in the use of "Unix"
versus "UNIX". Let's go with the trademark usage.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-12 04:45:38 +00:00
|
|
|
Details differ a bit between different UNIX systems.
|
2007-07-09 22:01:31 +00:00
|
|
|
The glibc implementation does not touch those fields which are not
|
2007-05-18 10:30:02 +00:00
|
|
|
explicitly specified, except that it recomputes the
|
2007-09-20 16:26:31 +00:00
|
|
|
.I tm_wday
|
2007-05-18 10:30:02 +00:00
|
|
|
and
|
2007-09-20 16:26:31 +00:00
|
|
|
.I tm_yday
|
2007-05-18 10:30:02 +00:00
|
|
|
field if any of the year, month, or day elements changed.
|
|
|
|
.PP
|
|
|
|
This function is available since libc 4.6.8.
|
|
|
|
Linux libc4 and libc5 includes define the prototype unconditionally;
|
2007-06-22 17:42:06 +00:00
|
|
|
glibc2 includes provide a prototype only when
|
|
|
|
.B _XOPEN_SOURCE
|
2007-06-22 20:40:07 +00:00
|
|
|
or
|
|
|
|
.B _GNU_SOURCE
|
2007-05-18 10:30:02 +00:00
|
|
|
are defined.
|
|
|
|
.PP
|
2008-06-09 15:49:35 +00:00
|
|
|
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.
|
2007-05-18 10:30:02 +00:00
|
|
|
.PP
|
2008-06-09 15:49:35 +00:00
|
|
|
The \(aqy\(aq (year in century) specification is taken to specify a year
|
2007-05-18 10:30:02 +00:00
|
|
|
in the 20th century by libc4 and libc5.
|
|
|
|
It is taken to be a year
|
|
|
|
in the range 1950-2049 by glibc 2.0.
|
|
|
|
It is taken to be a year in
|
|
|
|
1969-2068 since glibc 2.1.
|
|
|
|
.\" In libc4 and libc5 the code for %I is broken (fixed in glibc;
|
|
|
|
.\" %OI was fixed in glibc 2.2.4).
|
|
|
|
.SS Glibc Notes
|
2004-11-03 13:51:07 +00:00
|
|
|
For reasons of symmetry, glibc tries to support for
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR strptime ()
|
2004-11-03 13:51:07 +00:00
|
|
|
the same format characters as for
|
2007-05-12 00:30:29 +00:00
|
|
|
.BR strftime (3).
|
2004-11-03 13:51:07 +00:00
|
|
|
(In most cases the corresponding fields are parsed, but no field in \fItm\fP
|
|
|
|
is changed.)
|
|
|
|
This leads to
|
|
|
|
.TP
|
|
|
|
.B %F
|
|
|
|
Equivalent to \fB%Y-%m-%d\fP, the ISO 8601 date format.
|
|
|
|
.TP
|
|
|
|
.B %g
|
|
|
|
The year corresponding to the ISO week number, but without the century
|
|
|
|
(0-99).
|
|
|
|
.TP
|
|
|
|
.B %G
|
2008-06-28 04:57:20 +00:00
|
|
|
The year corresponding to the ISO week number.
|
|
|
|
(For example, 1991.)
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B %u
|
|
|
|
The day of the week as a decimal number (1-7, where Monday = 1).
|
|
|
|
.TP
|
|
|
|
.B %V
|
|
|
|
The ISO 8601:1988 week number as a decimal number (1-53).
|
|
|
|
If the week (starting on Monday) containing 1 January has four or more days
|
2007-04-12 22:42:49 +00:00
|
|
|
in the new year, then it is considered week 1.
|
|
|
|
Otherwise, it is the last week
|
2004-11-03 13:51:07 +00:00
|
|
|
of the previous year, and the next week is week 1.
|
|
|
|
.TP
|
|
|
|
.B %z
|
2008-09-07 04:17:25 +00:00
|
|
|
An RFC-822/ISO 8601 standard timezone specification.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B %Z
|
|
|
|
The timezone name.
|
|
|
|
.LP
|
2007-05-12 13:12:02 +00:00
|
|
|
Similarly, because of GNU extensions to
|
|
|
|
.BR strftime (3),
|
2007-07-09 21:02:59 +00:00
|
|
|
.B %k
|
|
|
|
is accepted as a synonym for
|
|
|
|
.BR %H ,
|
|
|
|
and
|
|
|
|
.B %l
|
|
|
|
should be accepted
|
|
|
|
as a synonym for
|
|
|
|
.BR %I ,
|
|
|
|
and
|
|
|
|
.B %P
|
|
|
|
is accepted as a synonym for
|
|
|
|
.BR %p .
|
2004-11-03 13:51:07 +00:00
|
|
|
Finally
|
|
|
|
.TP
|
|
|
|
.B %s
|
stime.2, time.2, utimensat.2, ctime.3, difftime.3, ftime.3, getspnam.3, mq_receive.3, mq_send.3, rtime.3, sem_wait.3, strftime.3, strptime.3, timeradd.3, rtc.4, core.5, proc.5, icmp.7, time.7: Global fix: Consistently define the Epoch
All definitions of the Epoch have been refactored to the following:
1970-01-01 00:00:00 +0000 (UTC)
That form is more consistent, logical, precise, and internationally
recognizable than the other variants.
Also, some wording has been altered as well.
Signed-off-by: Michael Witten <mfwitten@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-17 03:53:52 +00:00
|
|
|
The number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
|
2004-11-03 13:51:07 +00:00
|
|
|
Leap seconds are not counted unless leap second support is available.
|
|
|
|
.LP
|
2007-07-09 22:01:31 +00:00
|
|
|
The glibc implementation does not require whitespace between
|
2004-11-03 13:51:07 +00:00
|
|
|
two field descriptors.
|
2007-05-19 04:30:20 +00:00
|
|
|
.SH EXAMPLE
|
|
|
|
The following example demonstrates the use of
|
|
|
|
.BR strptime ()
|
|
|
|
and
|
|
|
|
.BR strftime (3).
|
|
|
|
.sp
|
|
|
|
.nf
|
2008-01-06 10:10:53 +00:00
|
|
|
#define _XOPEN_SOURCE
|
2007-05-19 04:30:20 +00:00
|
|
|
#include <stdio.h>
|
2007-09-10 02:44:09 +00:00
|
|
|
#include <stdlib.h>
|
2009-12-05 05:49:17 +00:00
|
|
|
#include <string.h>
|
2007-05-19 04:30:20 +00:00
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
|
|
|
struct tm tm;
|
|
|
|
char buf[255];
|
|
|
|
|
2009-12-05 05:49:17 +00:00
|
|
|
memset(&tm, 0, sizeof(struct tm));
|
2007-06-20 21:39:45 +00:00
|
|
|
strptime("2001\-11\-12 18:31:01", "%Y\-%m\-%d %H:%M:%S", &tm);
|
2007-05-19 04:30:20 +00:00
|
|
|
strftime(buf, sizeof(buf), "%d %b %Y %H:%M", &tm);
|
|
|
|
puts(buf);
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
.fi
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR time (2),
|
|
|
|
.BR getdate (3),
|
|
|
|
.BR scanf (3),
|
|
|
|
.BR setlocale (3),
|
getresuid.2, intro.2, mremap.2, open.2, poll.2, posix_fadvise.2, pread.2, remap_file_pages.2, setresuid.2, signal.2, splice.2, sync_file_range.2, tee.2, vmsplice.2, INFINITY.3, asprintf.3, assert_perror.3, basename.3, bsd_signal.3, canonicalize_file_name.3, clog10.3, crypt.3, dl_iterate_phdr.3, dlopen.3, dprintf.3, encrypt.3, exp10.3, fcloseall.3, fenv.3, ffs.3, fmemopen.3, fopencookie.3, ftw.3, getdate.3, getline.3, getloadavg.3, getopt.3, getsubopt.3, getutent.3, grantpt.3, hsearch.3, intro.3, lseek64.3, memmem.3, mempcpy.3, mq_receive.3, mq_send.3, posix_fallocate.3, pow10.3, program_invocation_name.3, ptsname.3, putgrent.3, readdir.3, sigset.3, sincos.3, stpcpy.3, stpncpy.3, strchr.3, strfry.3, strnlen.3, strptime.3, strsignal.3, strstr.3, strverscmp.3, swab.3, sysv_signal.3, tsearch.3, unlocked_stdio.3, unlockpt.3, wcpcpy.3, wcpncpy.3, wcsdup.3, wcwidth.3: SEE ALSO: Remove redundant reference to feature_test_macros(7)
Reported-by: Florian Lehmann <flo.lehmann@googlemail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-31 05:05:22 +00:00
|
|
|
.BR strftime (3)
|