:man| Alphabetical   Categories   About us 
 
STRPTIME (3) | C library functions | Unix Manual Pages | :man

NAME

strptime - parse date and time string

CONTENTS

Library
Synopsis
Description
Return Values
See Also
History
Authors
Bugs

LIBRARY


.Lb libc

SYNOPSIS


.In time.h char *
.Fo strptime "const char * restrict buf" "const char * restrict format" "struct tm * restrict timeptr"
.Fc

DESCRIPTION

The strptime function parses the string in the buffer buf according to the string pointed to by format, and fills in the elements of the structure pointed to by timeptr. The resulting values will be relative to the local time zone. Thus, it can be considered the reverse operation of strftime(3).

The format string consists of zero or more conversion specifications and ordinary characters. All ordinary characters are matched exactly with the buffer, where white space in the format string will match any amount of white space in the buffer. All conversion specifications are identical to those described in strftime(3).

Two-digit year values, including formats %y and %D, are now interpreted as beginning at 1969 per POSIX requirements. Years 69-00 are interpreted in the 20th century (1969-2000), years 01-68 in the 21st century (2001-2068).

If the format string does not contain enough conversion specifications to completely specify the resulting
.Vt struct tm , the unspecified members of timeptr are left untouched. For example, if format is ""%H:%M:%S"", only tm_hour, tm_sec and tm_min will be modified. If time relative to today is desired, initialize the timeptr structure with today’s date before passing it to strptime.

RETURN VALUES

Upon successful completion, strptime returns the pointer to the first character in buf that has not been required to satisfy the specified conversions in format. It returns NULL if one of the conversions failed.

SEE ALSO

date(1), scanf(3), strftime(3)

HISTORY

AUTHORS

BUGS


Share this page

     Follow us

Facebook Twitter Google+ LinkedIn


 
Created by Blin Media, 2008-2013