Index of Section 3 Manual Pages

Interix / SUAstrptime.3Interix / SUA

strptime(3)                                                 strptime(3)

  strptime

  NAME

    strptime() - convert dates and times

  SYNOPSIS

    #include 

    char * strptime(const char *buf, const char *format, struct tm *tm)

  DESCRIPTION

    The strptime(3) function reads a time and date in a character string (buf
    converts it according to the format specified by format, and stores the
    information in the struct tm pointed to by tm.

    The format string consists of directives; a directive is one or more
    white-space characters followed by an ordinary character or a conversion
    specification. (An ordinary character is any character other than a % or a
    white-space character; a conversion specification is one of the following
    conversion characters after a % character.) There must be white space or
    non-alphanumeric characters between any two conversion specifications.

    Here's how the directives are interpreted while scanning buf:
    *     For a whitespace directive, strptime(3) scans the input to the first
          non-whitespace character or until there are no more characters. That
          non-whitespace character remains unscanned.
    *     For an ordinary character directive, strptime(3) scans the next
          character from the buffer. If it matches the ordinary character
          directive, scanning continues to the next directive. If it doesn't
          match, the directive fails, and the differing and subsequent
          characters remain unscanned.
    *     For a series of directives that deal only with whitespace (%n, %t,
          and whitespace directives), strptime(3) scans up to the first non-
          whitespace character or until there are no more characters. That
          next non-whitespace character remains unscanned.
    *     For any other conversion directive, strptime(3) scans characters
          until it reaches a charcter matching the next directive or until no
          more characters can be scanned. These characters (excluding the one
          for the next directive) are compared to the values for the
          conversion specifier in the appropriate locale. If it matches,
          strptime(3) fills in the values of the tm structure. If there is no
          match, the strptime(3) call fails.

    The following conversion specifications are supported; for names, case is
    not important:

    %a
        The day of the week in the current locale, either the abbreviated or
        full name.

    %A
        Same as %a.

    %b
        The month in the current locale, either the abbreviated or the full
        name.

    %B
        Same as %b.

    %c
        The appropriate date and time representation for the locale.

    %C
        The century number as a number from 0-99. Leading zeroes are permitted
        but not required.

    %d
        The day of the month as a number from 1-31. Leading zeroes are
        permitted but not required.

    %D
        Equivalent to %m/%d/%y.

    %e
        The same as %d.

    %h
        The same as %b.

    %H
        The hour in a 24-hour clock (a number from 0-23). Leading zeroes are
        permitted but not required.

    %I
        The hour in a 12-hour clock (a number from 1-12). Leading zeroes are
        permitted but not required.

    %j
        The day of the year as a number from 1-366. Leading zeroes are
        permitted but not required.

    %m
        The month as a number from 1-12. Leading zeroes are permitted but not
        required.

    %M
        The minute of the hour as a number from 0-59. Leading zeroes are
        permitted but not required.

    %n
        Any white space.

    %p
        The equivalent of a.m. or p.m. in the current locale.

    %r
        is the 12-hour clock time using the AM/PM notation of the current
        locale, if t_fmt_ampm is not an empty string in the LC_TIME portion of
        the current locale. In the POSIX locale, this will be equivalent to
        %I:%M:%S %p.

    %R
        The time in the format %H:%M.

    %S
        The seconds of the current minute as a number from 0-61. Leading
        zeroes are permitted but not required.

    %t
        Any white space.

    %T
        The time, equivalent to %H:%M:%S.

    %U
        The week number of the year, as a decimal number in the range 00-53.
        Sunday is considered the first day of the week. Leading zeroes are
        permitted but not required.

    %w
        The week day as a number in the range 0-6, where 0 represents Sunday.
        Leading zeroes are permitted but not required.

    %W
        Like %U, but Monday is considered the first day of the week. The week
        number of the year, as a decimal number in the range 00-53. Leading
        zeroes are permitted but not required.

    %x
        The date in the format of the current locale.

    %X
        The time, in the format of the current locale.

    %y
        The year within the century, as a digit from 00-99. If no century is
        specified, values from 69-99 refer to the twentieth century (that is,
        1969-1999), and values from 00-68 refer to years in the twenty-first
        century (the years 2000 to 2068). Sunday is considered the first day
        of the week. Leading zeroes are permitted but not required.

    %Y
        The year, including the century, such as 2001 or 1984.

    %%
        A per cent character.

    Some of the directives can be modified by the characters E and O to
    indicate that they use an alternative format or specification. (For
    locales where this alternative specification doesn't exist, strptime(3)
    behaves as if the modifying E or O weren't present.)

    %Ec
        The alternative appropriate representative for the date and time.

    %EC
        The name of the base year (or time period) in the alternative
        representation for the locale.

    %Ex
        The alternative date representation for the locale.

    %EX
        The alternative time representation for the locale.

    %Ey
        The offset from the year (%EC) in the alternative representation of
        the year.

    %EY
        The full year representation in the locale's alternative
        representation.

    %Od
        The day of the month in the alternative representation of the locale.
        Leading zeroes are permitted but not required.

    %Oe
        The same as %Od.

    %OH
        The hour in the 24-hour clock using the alternative numeric symbols of
        the locale.

    %OI
        The hour in the 12-hour clock using the alternative numeric symbols of
        the locale.

    %Om
        The month using the alternative numeric symbols of the locale.

    %OM
        The minutes using the alternative numeric symbols of the locale.

    %OS
        The seconds using the alternative numeric symbols of the locale.

    %OU
        The week of the year as a number, using the alternative numeric
        symbols of the locale. Sunday is considered the first day of the week.

    %Ow
        The day of the week as a number using the alternative numeric symbols
        of the locale. Sunday is considered day 0.

    %OW
        The week of the year as a number, using the alternative numeric
        symbols of the locale. Monday is considered the first day of the week.

    %Oy
        The year, offset from %C, using the alternative numeric symbols of the
        locale.

  RETURN VALUES

    Upon a successful completion, strptime(3) function returns a pointer to
    the character following the last character parsed. On failure, it returns
    a null pointer.

  SEE ALSO

    scanf(3)

    strftime(3)

    time(2)

  USAGE NOTES

    The strptime function is thread safe.

    The strptime function is not async-signal safe.


Interix / SUAHosted at SUA Community for Interix, SUA and SFUInterix / SUA