strptime.3c (2010 09)

s
strptime(3C) strptime(3C)
NAME
strptime() - date and time conversion
SYNOPSIS
#include <time.h>
char *strptime(const char *buf, const char *format, struct tm *tm);
DESCRIPTION
The strptime() function converts the character string pointed to by buf to values which are stored in
the
tm structure pointed to by tm, using the format specified by format .
The format is composed of zero or more directives. Each directive is composed of one of the following:
one or more white-space characters (as specified by the
isspace() function); an ordinary character
(neither
% nor a white-space character); or a conversion specification. Each conversion specification is
composed of a % character followed by a conversion character which specifies the replacement required.
There must be whitespace or other non-alphanumeric characters between any two conversion
specifications. The following conversion specifications are supported:
%a is the day of week, using the locale’s weekday names; either the abbreviated or full name may
be specified.
%A is the same as %a.
%b is the month, using the locale’s month names; either the abbreviated or full name may be
specified.
%B is the same as %b.
%c is the date and time, using locale’s date and time format (for example, as
%x %X).
%C is the century number [0,99]; leading zeros are permitted but not required.
%d is the day of month [1,31]; leading zeros are permitted but not required.
%D is the date as %m/%d/%y.
%e is the same as %d.
%h is the same as %b.
%H is the hour (24-hour clock) [0,23]; leading zeros are permitted but not required.
%I is the hour (12-hour clock) [1,12]; leading zeros are permitted but not required.
%j is the day number of the year [1,366]; leading zeros are permitted but not required.
%m is the month number [1,12]; leading zeros are permitted but not required.
%M is the minute [0,59]; leading zeros are permitted but not required.
%n is any whitespace.
%p is the locale’s equivalent of a.m or p.m.
%r is the 12-hour clock time in AM/PM notation equivalent to %I:%M:%S %p format or the for-
mat specified in t_fmt_ampm of the LC_TIME portion of the current locale, if it is not empty.
Otherwise, returns NULL.
%R is the time as %H:%M.
%S is the seconds [0,60]; leading zeros are permitted but not required.
%t is any whitespace.
%T is the time as %H:%M:%S.
%U is the week number of the year (Sunday as the first day of the week) as a decimal number
[0,53]; leading zeros are permitted but not required. All days in a year preceding the first Sun-
day are considered to be in week 0.
%w is the weekday as a decimal number [0,6], with 0 representing Sunday; leading zeros are per-
mitted but not required.
%W is the week number of the year (Monday as the first day of the week) as a decimal number
[0,53]; leading zeros are permitted but not required. All days in a year preceding the first
HP-UX 11i Version 3: September 2010 1 Hewlett-Packard Company 1

Summary of content (4 pages)