IceWalkers.com - Linux Software downloads and news
Name : Password :
Linux SoftwareLinux RPMLinux HowtosLink UsAboutAdvertise

strptime (3)

STRPTIME(3)                Linux Programmer's Manual               STRPTIME(3)



NAME
       strptime  - convert a string representation of time to a time tm struc-
       ture

SYNOPSIS
       #define_XOPEN_SOURCE /* glibc2 needs this */
       #include<time.h>

       char*strptime(constchar*s,constchar*format,structtm*tm);

DESCRIPTION
       The strptime() function is the converse function to strftime() and con-
       verts  the  character string pointed to by s to values which are stored
       in the tm structure pointed to by tm, using  the  format  specified  by
       format.   Here  format  is  a  character  string that consists of field
       descriptors and text characters, reminiscent of scanf(3).   Each  field
       descriptor consists of a % character followed by another character that
       specifies the replacement for the field descriptor.  All other  charac-
       ters  in  the format string must have a matching character in the input
       string, except for whitespace, which matches zero  or  more  whitespace
       characters  in  the  input string.  There should be whitespace or other
       alphanumeric characters between any two field descriptors.

       The strptime() function processes the input string from left to  right.
       Each of the three possible input elements (whitespace, literal, or for-
       mat) 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 supported input field descriptors are listed below.  In case a text
       string (such as a weekday or month name) is to be matched, the compari-
       son is case insensitive.  In case a number is to  be  matched,  leading
       zeros are permitted but not required.

       %%     The % character.

       %a or %A
              The weekday name according to the current locale, in abbreviated
              form or the full name.

       %b or %B or %h
              The month name according to the current locale,  in  abbreviated
              form or the full name.

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

       %C     The century number (0-99).

       %d or %e
              The day of month (1-31).

       %D     Equivalent  to  %m/%d/%y. (This is the American style date, very
              confusing to non-Americans, especially since %d/%m/%y is  widely
              used in Europe.  The ISO 8601 standard format is %Y-%m-%d.)

       %H     The hour (0-23).

       %I     The hour on a 12-hour clock (1-12).

       %j     The day number in the year (1-366).

       %m     The month number (1-12).

       %M     The minute (0-59).

       %n     Arbitrary whitespace.

       %p     The  locale's equivalent of AM or PM. (Note: there may be none.)

       %r     The 12-hour clock time (using the locale's AM or  PM).   In  the
              POSIX  locale equivalent to %I:%M:%S %p.  If t_fmt_ampm is empty
              in the LC_TIME part of the current locale then the behaviour  is
              undefined.

       %R     Equivalent to %H:%M.

       %S     The second (0-60; 60 may occur for leap seconds; earlier also 61
              was allowed).

       %t     Arbitrary whitespace.

       %T     Equivalent to %H:%M:%S.

       %U     The week number with Sunday the first day of  the  week  (0-53).
              The first Sunday of January is the first day of week 1.

       %w     The weekday number (0-6) with Sunday = 0.

       %W     The  week  number  with Monday the first day of the week (0-53).
              The first Monday of January is the first day of week 1.

       %x     The date, using the locale's date format.

       %X     The time, using the locale's time format.

       %y     The year within century (0-99).  When a century is not otherwise
              specified, values in the range 69-99 refer to years in the twen-
              tieth century (1969-1999); values in the range  00-68  refer  to
              years in the twenty-first century (2000-2068).

       %Y     The year, including century (for example, 1991).

       Some  field  descriptors can be modified by the E or O modifier charac-
       ters to indicate that an alternative format or specification should  be
       used.  If the alternative format or specification does not exist in the
       current locale, the unmodified field descriptor is used.

       The E modifier specifies that the input string may contain  alternative
       locale-dependent versions of the date and time representation:

       %Ec    The locale's alternative date and time representation.

       %EC    The  name  of the base year (period) in the locale's alternative
              representation.

       %Ex    The locale's alternative date representation.

       %EX    The locale's alternative time representation.

       %Ey    The offset from %EC (year only) in the locale's alternative rep-
              resentation.

       %EY    The full alternative year representation.

       The O modifier specifies that the numerical input may be in an alterna-
       tive locale-dependent format:

       %Od or %Oe
              The day of the month using the locale's alternative numeric sym-
              bols; leading zeros are permitted but not required.

       %OH    The  hour (24-hour clock) using the locale's alternative numeric
              symbols.

       %OI    The hour (12-hour clock) using the locale's alternative  numeric
              symbols.

       %Om    The month using the locale's alternative numeric symbols.

       %OM    The minutes using the locale's alternative numeric symbols.

       %OS    The seconds using the locale's alternative numeric symbols.

       %OU    The  week  number  of  the  year (Sunday as the first day of the
              week) using the locale's alternative numeric symbols.

       %Ow    The number of the weekday (Sunday=0) using the locale's alterna-
              tive numeric symbols.

       %OW    The  week  number  of  the  year (Monday as the first day of the
              week) using the locale's alternative numeric symbols.

       %Oy    The year (offset from %C) using the locale's alternative numeric
              symbols.

       The broken-down time structure tm is defined in <time.h> as follows:

              struct tm {
                      int     tm_sec;         /* seconds */
                      int     tm_min;         /* minutes */
                      int     tm_hour;        /* hours */
                      int     tm_mday;        /* day of the month */
                      int     tm_mon;         /* month */
                      int     tm_year;        /* year */
                      int     tm_wday;        /* day of the week */
                      int     tm_yday;        /* day in the year */
                      int     tm_isdst;       /* daylight saving time */
              };

RETURNVALUE
       The  return  value  of the function is a pointer to the first character
       not processed in this function call.  In case the input string contains
       more  characters  than  required  by the format string the return value
       points right after the last consumed  input  character.   In  case  the
       whole  input string is consumed the return value points to the NUL byte
       at the end of the string.  If strptime() fails to match all of the for-
       mat string and therefore an error occurred the function returns NULL.

CONFORMINGTO
       XPG4, SUSv2, POSIX 1003.1-2001.

EXAMPLE
       The  following  example  demonstrates  the  use of strptime() and strf-
       time().

       #include <stdio.h>
       #include <time.h>

       int main() {
               struct tm tm;
               char buf[255];

               strptime("2001-11-12 18:31:01", "%Y-%m-%d %H:%M:%S", &tm);
               strftime(buf, sizeof(buf), "%d %b %Y %H:%M", &tm);
               puts(buf);
               return 0;
       }

GNUEXTENSIONS
       For reasons of symmetry, glibc tries to support for strptime  the  same
       format  characters  as  for strftime.  (In most cases the corresponding
       fields are parsed, but no field in tm is changed.)  This leads to

       %F     Equivalent to %Y-%m-%d, the ISO 8601 date format.

       %g     The year corresponding to the ISO week number, but  without  the
              century (0-99).

       %G     The  year  corresponding  to  the ISO week number. (For example,
              1991.)

       %u     The day of the week as a decimal number (1-7, where Monday = 1).

       %V     The  ISO  8601:1988  week number as a decimal number (1-53).  If
              the week (starting on Monday) containing 1 January has  four  or
              more  days in the new year, then it is considered week 1. Other-
              wise, it is the last week of the previous  year,  and  the  next
              week is week 1.

       %z     An RFC-822/ISO 8601 standard time zone specification.

       %Z     The timezone name.

       Similarly,  because  of GNU extensions to strftime, %k is accepted as a
       synonym for %H, and %l should be accepted as a synonym for %I,  and  %P
       is accepted as a synonym for %p.  Finally

       %s     The  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.

       The  GNU  libc  implementation  does not require whitespace between two
       field descriptors.

NOTES
       In principle, this function does not initialize tm but only stores  the
       values  specified.  This means that tm should be initialized before the
       call.  Details differ a bit between different Unix  systems.   The  GNU
       libc  implementation  does not touch those fields which are not explic-
       itly specified, except that it recomputes the tm_wday and tm_yday field
       if any of the year, month, or day elements changed.

       This  function  is  available  since libc 4.6.8.  Linux libc4 and libc5
       includes define the prototype unconditionally; glibc2 includes  provide
       a prototype only when _XOPEN_SOURCE or _GNU_SOURCE are defined.

       Before  libc 5.4.13 whitespace (and the 'n' and 't' specifications) was
       not handled, no 'E' and 'O' locale modifier characters  were  accepted,
       and the 'C' specification was a synonym for the 'c' specification.

       The  'y'  (year in century) specification is taken to specify a year in
       the 20th century by libc4 and libc5. It is taken to be a  year  in  the
       range  1950-2049  by  glibc  2.0. It is taken to be a year in 1969-2068
       since glibc 2.1.

SEEALSO
       time(2), getdate(3), scanf(3), setlocale(3), strftime(3)



GNU                               2001-11-12                       STRPTIME(3)

CMSG_ALIGNfmodllroundfstrncmp
CMSG_FIRSTHDRfnmatchllroundlstrncpy
CMSG_NXTHDRfopenlocaleconvstrndup
CMSG_SPACEforkptylocaltimestrndupa
MB_CUR_MAXfpathconflockfstrnlen
MB_LEN_MAXfprintflogstrpbrk
__fbufsizefpurgelog10strptime
__flbffputclog1pstrrchr
__fpendingfputc_unlockedlogin_ttystrsep
__fpurgefputslogwtmpstrsignal
__freadablefputs_unlockedlongjmpstrspn
__freadingfputwclrand48strstr
__fsetlockingfputwc_unlockedlrintstrtod
__fwritablefputwslrintfstrtof
__fwritingfputws_unlockedlrintlstrtok
__malloc_hookfreadlroundstrtok_r
__setfpucwfread_unlockedlroundfstrtol
_flushlbffreelroundlstrtold
a64lfreeaddrinfolsearchstrtoll
abortfreehostentmakecontextstrtoq
absfreopenmallocstrtoul
acosfrexpmalloc_hookstrtoull
acoshfscanfmblenstrtouq
addmntentfseekmbrlenstrverscmp
allocafseekombrtowcstrxfrm
alphasortfsetposmbsinitsvc_destroy
argz_addftellmbsnrtowcssvc_freeargs
argz_add_sepftellombsrtowcssvc_getargs
argz_appendftimembstowcssvc_getcaller
argz_countftokmbtowcsvc_getreq
argz_createftrylockfilememalignsvc_getreqset
argz_create_sepftsmemccpysvc_register
argz_deletefts_childrenmemchrsvc_run
argz_extractfts_closememcmpsvc_sendreply
argz_insertfts_openmemcpysvc_unregister
argz_nextfts_readmemfrobsvcerr_auth
argz_replacefts_setmemmemsvcerr_decode
argz_stringifyftwmemmovesvcerr_noproc
asctimefunlockfilememrchrsvcerr_noprog
asinfwidememsetsvcerr_progvers
asinhfwprintfmkdtempsvcerr_systemerr
asprintffwritemkfifosvcerr_weakauth
assertfwrite_unlockedmkstempsvcfd_create
assert_perrorgai_strerrormktempsvcraw_create
atangammamktimesvctcp_create
atan2gammafmodfsvcudp_bufcreate
atanhgammalmpoolsvcudp_create
atexitgcvtmrand48swab
atofget_current_dir_namemtraceswapcontext
atoiget_myaddressmuntraceswprintf
atolgetaddrinfonansysconf
atollgetcnanfsyslog
atoqgetc_unlockednanlsystem
auth_destroygetcharnearbyinttan
authnone_creategetchar_unlockednearbyintftanh
authunix_creategetcwdnearbyintltcdrain
authunix_create_defaultgetdatenetlinktcflow
basenamegetdate_rnextaftertcflush
bcmpgetdelimnextafterftcgetattr
bcopygetdirentriesnextafterltcgetpgrp
bindresvportgetenvnexttowardtcgetsid
bsearchgetfsentnexttowardftcsendbreak
bstringgetfsfilenexttowardltcsetattr
btowcgetfsspecnftwtcsetpgrp
btreegetgrentnl_langinfotdelete
byteordergetgrgidnrand48telldir
bzerogetgrnamntohltempnam
callocgethostbyaddrntohstermios
callrpcgethostbynameon_exittfind
catclosegethostbyname2opendirtgamma
catgetsgethostbyname2_ropenlogtgammaf
catopengethostbyname_ropenptytgammal
cbrtgetipnodebyaddrpathconftimegm
ceilgetipnodebynamepclosetimelocal
ceilfgetlineperrortmpfile
ceillgetloadavgpmap_getmapstmpnam
cfgetispeedgetloginpmap_getporttoascii
cfgetospeedgetmntentpmap_rmtcalltolower
cfmakerawgetnameinfopmap_settoupper
cfsetispeedgetnetbyaddrpmap_unsettowctrans
cfsetospeedgetnetbynamepopentowlower
clearenvgetnetentposix_memaligntowupper
clearerrgetoptpowtrunc
clearerr_unlockedgetopt_longprintftruncf
clnt_broadcastgetopt_long_onlyprofiltruncl
clnt_callgetpasspsignaltsearch
clnt_controlgetprotobynameptsnamettyname
clnt_creategetprotobynumberputcttyname_r
clnt_destroygetprotoentputc_unlockedttyslot
clnt_freeresgetptputchartwalk
clnt_geterrgetpwputchar_unlockedtzset
clnt_pcreateerrorgetpwentputenvulimit
clnt_perrnogetpwnamputpwentundocumented
clnt_perrorgetpwuidputsungetc
clnt_spcreateerrorgetrpcbynamepututlineungetwc
clnt_sperrnogetrpcbynumberpututxlineunlocked_stdio
clnt_sperrorgetrpcentputwunlockpt
clntraw_creategetrpcportputwcunsetenv
clnttcp_creategetsputwc_unlockedupdwtmp
clntudp_bufcreategetservbynameputwcharusleep
clntudp_creategetservbyportputwchar_unlockedutmpname
clockgetserventqecvtva_arg
closedirgetttyentqecvt_rva_end
closeloggetttynamqfcvtva_start
cmsggetumaskqfcvt_rvalloc
confstrgetusershellqgcvtvasprintf
copysigngetutentqsortvdprintf
copysignfgetutidqueueverr
copysignlgetutlineraiseverrx
cosgetutxentrandversionsort
coshgetutxidrandomvfprintf
cryptgetutxlinercmdvfscanf
ctermidgetwre_compvfwprintf
ctimegetwcre_execvprintf
cuseridgetwc_unlockedreaddirvscanf
daemongetwcharreallocvsnprintf
dbgetwchar_unlockedrealpathvsprintf
dbopengetwdrecnovsscanf
difftimeglobregcompvswprintf
dirfdglobfreeregerrorvsyslog
dirnamegmtimeregexvwarn
divgrantptregexecvwarnx
dlclosegsignalregfreevwprintf
dlerrorhashregisterrpcwarn
dlopenhasmntoptremovewarnx
dlsymhcreateremquewcpcpy
dn_comphcreate_rres_initwcpncpy
dn_expandhdestroyres_mkquerywcrtomb
dprintfhdestroy_rres_querywcscasecmp
drand48herrorres_querydomainwcscat
dremhsearchres_searchwcschr
dysizehsearch_rres_sendwcscmp
ecvthstrerrorresolverwcscpy
ecvt_rhtonlrewindwcscspn
encrypthtonsrewinddirwcsdup
endfsenthypotrindexwcslen
endgrenticonvrintwcsncasecmp
endhostenticonv_closerintfwcsncat
endmntenticonv_openrintlwcsncmp
endnetentimaxabsroundwcsncpy
endprotoentindexroundfwcsnlen
endpwentinetroundlwcsnrtombs
endrpcentinet_addrrpcwcspbrk
endserventinet_atonrresvportwcsrchr
endttyentinet_lnaofrtnetlinkwcsrtombs
endusershellinet_makeaddrruserokwcsspn
endutentinet_netofscandirwcsstr
endutxentinet_networkscanfwcstok
envz_addinet_ntoaseed48wcstombs
envz_entryinet_ntopseekdirwcswidth
envz_getinet_ptonsetbufwctob
envz_mergeinfnansetbufferwctomb
envz_removeinitgroupssetenvwctrans
envz_stripinitstatesetfsentwctype
erand48insquesetgrentwcwidth
erfintrosethostentwmemchr
erfciruseroksetjmpwmemcmp
errisalnumsetkeywmemcpy
errnoisalphasetlinebufwmemmove
errxisasciisetlocalewmemset
ether_atonisattysetlogmaskwprintf
ether_aton_risblanksetmntentxdr
ether_hosttoniscntrlsetnetentxdr_accepted_reply
ether_lineisdigitsetprotoentxdr_array
ether_ntoaisgraphsetpwentxdr_authunix_parms
ether_ntoa_risinfsetrpcentxdr_bool
ether_ntohostislowersetserventxdr_bytes
execisnansetstatexdr_callhdr
execlisprintsetttyentxdr_callmsg
execleispunctsetusershellxdr_char
execlpisspacesetutentxdr_destroy
execvisuppersetutxentxdr_double
execvpiswalnumsetvbufxdr_enum
exitiswalphashm_openxdr_float
expiswblanksigaddsetxdr_free
expm1iswcntrlsigdelsetxdr_getpos
fabsiswctypesigemptysetxdr_inline
fabsfiswdigitsigfillsetxdr_int
fabsliswgraphsiginterruptxdr_long
fcloseiswlowersigismemberxdr_opaque
fclosealliswprintsiglongjmpxdr_opaque_auth
fcvtiswpunctsignbitxdr_pmap
fcvt_riswspacesigsetjmpxdr_pmaplist
fdopeniswuppersigsetopsxdr_pointer
feclearexceptiswxdigitsinxdr_reference
fegetenvisxdigitsinhxdr_rejected_reply
fegetexceptflagj0sleepxdr_replymsg
fegetroundj0fsnprintfxdr_setpos
feholdexceptj0lsprintfxdr_short
fenvj1sqrtxdr_string
feofj1fsrandxdr_u_char
feof_unlockedj1lsrand48xdr_u_int
feraiseexceptjnsrandomxdr_u_long
ferrorjnfsscanfxdr_u_short
ferror_unlockedjnlssignalxdr_union
fesetenvjrand48stdargxdr_vector
fesetexceptflagkey_decryptsessionstderrxdr_void
fesetroundkey_encryptsessionstdinxdr_wrapstring
fetestexceptkey_gendesstdioxdrmem_create
feupdateenvkey_secretkey_is_setstdio_extxdrrec_create
fflushkey_setsecretstdoutxdrrec_endofrecord
fflush_unlockedkillpgstpcpyxdrrec_eof
ffsklogctlstpncpyxdrrec_skiprecord
fgetcl64astrcasecmpxdrstdio_create
fgetc_unlockedlabsstrcatxprt_register
fgetgrentlcong48strchrxprt_unregister
fgetposldexpstrcmpy0
fgetpwentldivstrcolly0f
fgetslfindstrcpyy0l
fgets_unlockedlgammastrcspny1
fgetwclgamma_rstrdupy1f
fgetwc_unlockedlgammafstrdupay1l
fgetwslgammaf_rstrerroryn
fgetws_unlockedlgammalstrerror_rynf
filenolgammal_rstrfmonynl
fileno_unlockedllabsstrfry 
finitelldivstrftime 
flockfilellrintstring 
floorllrintfstrlen 
floorfllrintlstrncasecmp 


The Gimp 2.6.3
GNU Image Manipulation Program
Linux Kernel 2.6 2.6.27.7
Linux Kernel
Battle for Wesnoth 1.4.6
Fantasy Turn-Based Strategy Game
DeleGate 9.9.0-pre8
Proxy server which runs on multiple platforms
Safesquid proxy server 4.2.2.RC8.14B
Antivirus and content filtering proxy server
Thunderbird 2.0.0.18
An email and newsgroup client with powerful, new junk mail controls
Wine 1.1.9
Free implementation of Windows on Unix
WebGUI 7.5.34
A fully featured content management system.
KOffice 2.0 beta3
Integrated office suite for KDE
LimeWire 4.18.8
Gnutella Client
Free IT Magazines, White Papers, eBooks, and more !
Oracle Magazine

Contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more.

eWeek

The essential technology information source for builders of e-business.

BusinessWeek (Digital Edition)

Provides readers a deeper understanding of the trends that drive growth, and what best practices keep them ahead of the competition.

Linux Software Map
Find Linux RPM
Best Rated Linux Software
Most Rated Linux Software
Linux Distributions
Linux Howtos
Quick Survey

Please take our survey and help us improve our website to serve you better.

Thank you.
Linux Software
Linux / IT Resources
Site Resources
Google
Privacy Policy
Contact Us
Submit Software
Advertising info