HP-UX Reference (11i v2 04/09) - 3 Library Functions N-Z (vol 7)
s
strptime(3C) strptime(3C)
%x is the date, using the locale’s date format.
%X is the time, using the locale’s time format.
%y is the year within the century [0,99]; leading zeros are permitted but not required. If no cen-
tury has been specified (for example, via the
%C directive), the 20th century (1900s) is assumed
for inputs in the range 69-99, and the 21st century (2000s) is assumed for inputs in the range
00-68.
%Y is the year, including the century (for example, 1992).
%% is replaced by %.
Modified Directives
Some directives can be modified by the
E and O modifier characters to indicate that an alternative for-
mat or specification should be used rather than the one normally used by the unmodified directive. If the
alternative format or specification does not exist in the current locale, the behavior will be as if the
unmodified directive were used.
%Ec is the locale’s alternative appropriate date and time representation.
%EC is the name of the base year (period) in the locale’s alternative representation.
%Ex is the locale’s alternative date representation.
%EX is the locale’s alternative time representation.
%Ey is the offset from %EC (year only) in the locale’s alternative representation.
%EY is the full alternative year representation.
%Od is the day of the month using the locale’s alternative numeric symbols; leading zeros are per-
mitted by not required.
%Oe is the same as %Od.
%OH is the hour (24-hour clock) using the locale’s alternative numeric symbols.
%OI is the hour (12-hour clock) using the locale’s alternative numeric symbols.
%Om is the month using the locale’s alternative numeric symbols.
%OM is the minutes using the locale’s alternative numeric symbols.
%OS is the seconds using the locale’s alternative numeric symbols.
%OU is the week number of the year (Sunday as the first day of the week) using the locale’s’ alterna-
tive numeric symbols.
%Ow is the number of the weekday (Sunday=0) using the locale’s alternative numeric symbols.
%OW is the week number of the year (Monday as the first day of the week) using the locale’s alterna-
tive numeric symbols.
%Oy is the year (offset from %C) in the locale’s alternative representation and using the locale’s
alternative numeric symbols.
A directive composed of whitespace characters is executed by scanning input up to the first character that
is not whitespace (which remains unscanned), or until no more characters can be scanned.
A directive that is an ordinary character is executed by scanning the next character from the buffer. If
the character scanned from the buffer differs from the one comprising the directive, the directive fails,
and the differing and subsequent characters remain unscanned.
A series of directives composed of
%n, %t, whitespace characters or any combination thereof is executed
by scanning up to the first character that is not white space (which remains unscanned), or until no more
characters can be scanned.
Any other conversion specification is executed by scanning characters until a character matching the next
directive is scanned, or until no more characters can be scanned. These characters, except the one match-
ing the next directive, are then compared to the locale values associated with the conversion specifier. If
a match is found, values for the appropriate
tm structure members are set to values corresponding to the
locale information. Case is ignored when matching items in buf such as month or weekday names. If no
match is found, strptime() fails and no more characters are scanned. If the date specified exceeds
the maximum time representable by the time_t data type in 32-bit HP-UX (which represents Tuesday
Section 3−−1024 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: September 2004