| The strptimefunction parses the input string s according
to the format string fmt and stores its results in the
structure tp.The input string could be generated by a strftimecall or
obtained any other way.  It does not need to be in a human-recognizable
format; e.g. a date passed as"02:1999:9"is acceptable, even
though it is ambiguous without context.  As long as the format string
fmt matches the input string the function will succeed. The user has to make sure, though, that the input can be parsed in a
unambiguous way.  The string "1999112"can be parsed using the
format"%Y%m%d"as 1999-1-12, 1999-11-2, or even 19991-1-2.  It
is necessary to add appropriate separators to reliably get results. The format string consists of the same components as the format string
of the strftimefunction.  The only difference is that the flags_,-,0, and^are not allowed. 
Several of the distinct formats ofstrftimedo the same work instrptimesince differences like case of the input do not matter. 
For reasons of symmetry all formats are supported, though. The modifiers EandOare also allowed everywhere thestrftimefunction allows them. The formats are:
 
%a%AThe weekday name according to the current locale, in abbreviated form or
the full name.
%b%B%hThe month name according to the current locale, in abbreviated form or
the full name.
%cThe date and time representation for the current locale.
%EcLike %cbut the locale's alternative date and time format is used.
%CThe century of the year.
It makes sense to use this format only if the format string also
contains the %yformat.
%ECThe locale's representation of the period.
Unlike %Cit sometimes makes sense to use this format since some
cultures represent years relative to the beginning of eras instead of
using the Gregorian years.
%d
 %eThe day of the month as a decimal number (range 1through31). 
Leading zeroes are permitted but not required.
%Od%OeSame as %dbut using the locale's alternative numeric symbols.Leading zeroes are permitted but not required.
%DEquivalent to %m/%d/%y.
%FEquivalent to %Y-%m-%d, which is the ISO 8601 date
format.This is a GNU extension following an ISO C99 extension to
strftime.
%gThe year corresponding to the ISO week number, but without the century
(range 00through99).Note: Currently, this is not fully implemented.  The format is
recognized, input is consumed but no field in tm is set.
 This format is a GNU extension following a GNU extension of strftime.
%GThe year corresponding to the ISO week number.
Note: Currently, this is not fully implemented.  The format is
recognized, input is consumed but no field in tm is set.
 This format is a GNU extension following a GNU extension of strftime.
%H%kThe hour as a decimal number, using a 24-hour clock (range 00through23).%kis a GNU extension following a GNU extension ofstrftime.
%OHSame as %Hbut using the locale's alternative numeric symbols.
%I%lThe hour as a decimal number, using a 12-hour clock (range 01through12).%lis a GNU extension following a GNU extension ofstrftime.
%OISame as %Ibut using the locale's alternative numeric symbols.
%jThe day of the year as a decimal number (range 1through366).Leading zeroes are permitted but not required.
%mThe month as a decimal number (range 1through12).Leading zeroes are permitted but not required.
%OmSame as %mbut using the locale's alternative numeric symbols.
%MThe minute as a decimal number (range 0through59).Leading zeroes are permitted but not required.
%OMSame as %Mbut using the locale's alternative numeric symbols.
%n%tMatches any white space.
%p
 %PThe locale-dependent equivalent to AMorPM.This format is not useful unless %Ior%lis also used. 
Another complication is that the locale might not define these values at
all and therefore the conversion fails. %Pis a GNU extension following a GNU extension tostrftime.
%rThe complete time using the AM/PM format of the current locale.
A complication is that the locale might not define this format at all
and therefore the conversion fails.
%RThe hour and minute in decimal numbers using the format %H:%M.%Ris a GNU extension following a GNU extension tostrftime.
%sThe number of seconds since the epoch, i.e., since 1970-01-01 00:00:00 UTC. 
Leap seconds are not counted unless leap second support is available.
%sis a GNU extension following a GNU extension tostrftime.
%SThe seconds as a decimal number (range 0through60).Leading zeroes are permitted but not required.
 Note: The Unix specification says the upper bound on this value
is 61, a result of a decision to allow double leap seconds.  You
will not see the value61because no minute has more than one
leap second, but the myth persists.
%OSSame as %Sbut using the locale's alternative numeric symbols.
%TEquivalent to the use of %H:%M:%Sin this place.
%uThe day of the week as a decimal number (range 1through7), Monday being1.Leading zeroes are permitted but not required.
 Note: Currently, this is not fully implemented.  The format is
recognized, input is consumed but no field in tm is set.
%UThe week number of the current year as a decimal number (range 0through53).Leading zeroes are permitted but not required.
%OUSame as %Ubut using the locale's alternative numeric symbols.
%VThe ISO 8601:1988 week number as a decimal number (range 1through53).Leading zeroes are permitted but not required.
 Note: Currently, this is not fully implemented.  The format is
recognized, input is consumed but no field in tm is set.
%wThe day of the week as a decimal number (range 0through6), Sunday being0.Leading zeroes are permitted but not required.
 Note: Currently, this is not fully implemented.  The format is
recognized, input is consumed but no field in tm is set.
%OwSame as %wbut using the locale's alternative numeric symbols.
%WThe week number of the current year as a decimal number (range 0through53).Leading zeroes are permitted but not required.
 Note: Currently, this is not fully implemented.  The format is
recognized, input is consumed but no field in tm is set.
%OWSame as %Wbut using the locale's alternative numeric symbols.
%xThe date using the locale's date format.
%ExLike %xbut the locale's alternative data representation is used.
%XThe time using the locale's time format.
%EXLike %Xbut the locale's alternative time representation is used.
%yThe year without a century as a decimal number (range 0through99).Leading zeroes are permitted but not required.
 Note that it is questionable to use this format without
the %Cformat.  Thestrptimefunction does regard input
values in the range 68 to 99 as the years 1969 to
1999 and the values 0 to 68 as the years
2000 to 2068.  But maybe this heuristic fails for some
input data. Therefore it is best to avoid %ycompletely and use%Yinstead.
%EyThe offset from %ECin the locale's alternative representation.
%OyThe offset of the year (from %C) using the locale's alternative
numeric symbols.
%YThe year as a decimal number, using the Gregorian calendar.
%EYThe full alternative year representation.
%zThe offset from GMT in ISO 8601/RFC822 format.
%ZThe timezone name.
Note: Currently, this is not fully implemented.  The format is
recognized, input is consumed but no field in tm is set.
%%A literal %character. All other characters in the format string must have a matching character
in the input string.  Exceptions are white spaces in the input string
which can match zero or more white space characters in the format string.
 The strptimefunction processes the input string from right to
left.  Each of the three possible input elements (white space, 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. The function returns a pointer to the first character it was unable to
process.  If the input string contains more characters than required by
the format string the return value points right after the last consumed
input character.  If the whole input string is consumed the return value
points to the NULLbyte at the end of the string.  If an error
occurs, i.e.strptimefails to match all of the format string,
the function returnsNULL. |