Print this page
Garrett's man page edits.
   1 '\" te
   2 .\" Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
   3 .\" Portions Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
   4 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   5 .\" http://www.opengroup.org/bookstore/.
   6 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
   7 .\"  This notice shall appear on any product containing this material.
   8 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   9 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
  10 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
  11 .TH STRPTIME 3C "Aug 27, 2007"
  12 .SH NAME
  13 strptime, strptime_l \- date and time conversion
  14 .SH SYNOPSIS
  15 .LP
  16 .nf
  17 #include <time.h>
  18 
  19 \fBchar *\fR\fBstrptime\fR(\fBconst char *restrict\fR \fIbuf\fR,
  20      \fBconst char *restrict\fR \fIformat\fR, \fBstruct tm *restrict\fR \fItm\fR);





  21 
  22 \fBchar *\fR\fBstrptime_l\fR(\fBconst char *restrict\fR \fIbuf\fR,
  23      \fBconst char *restrict\fR \fIformat\fR, \fBstruct tm *restrict\fR \fItm\fR,
  24      \fBlocale_t\fR \fIloc\fR);
  25 .fi
  26 
  27 .SS "Non-zeroing Behavior"
  28 .LP
  29 .nf
  30 \fBcc\fR [\fIflag\fR...]  \fIfile\fR... \fB-D_STRPTIME_DONTZERO\fR [\fIlibrary\fR...]
  31 #include <time.h>
  32 
  33 \fBchar *\fR\fBstrptime\fR(\fBconst char *restrict\fR \fIbuf\fR,
  34      \fBconst char *restrict\fR \fIformat\fR, \fBstruct tm *restrict\fR \fItm\fR);
  35 .fi
  36 
  37 .SH DESCRIPTION
  38 .sp
  39 .LP
  40 The \fBstrptime()\fR function converts the character string pointed to by
  41 \fIbuf\fR to values which are stored in the \fBtm\fR structure pointed to by
  42 \fItm\fR, using the format specified by \fIformat\fR. The \fBstrptime_l()\fR
  43 function is identical to \fBstrptime()\fR except instead of acting in the
  44 current locale, it acts in the locale specified by the argument \fIloc\fR.
  45 .sp
  46 .LP
  47 The \fIformat\fR argument is composed of zero or more conversion
  48 specifications. Each conversion specification is composed of a "%" (percent)
  49 character followed by one or two conversion characters which specify the
  50 replacement required. One or more white space characters (as specified by
  51 \fBisspace\fR(3C)) may precede or follow a conversion specification. There must
  52 be white-space or other non-alphanumeric characters between any two conversion
  53 specifications.
  54 .sp
  55 .LP
  56 A non-zeroing version of \fBstrptime()\fR, described below under \fBNon-zeroing
  57 Behavior\fR, is provided if \fB_STRPTIME_DONTZERO\fR is defined.
  58 .SS "Conversion Specifications"
  59 .sp
  60 .LP
  61 The following conversion specifications are supported:
  62 .sp
  63 .ne 2
  64 .na
  65 \fB\fB%%\fR\fR
  66 .ad
  67 .RS 6n
  68 Same as \fB%\fR.
  69 .RE
  70 
  71 .sp
  72 .ne 2
  73 .na
  74 \fB\fB%a\fR\fR
  75 .ad
  76 .RS 6n
  77 Day of week, using the locale's weekday names;  either the abbreviated or full
  78 name may be specified.
  79 .RE


 349 
 350 .sp
 351 .ne 2
 352 .na
 353 \fB\fB%Y\fR\fR
 354 .ad
 355 .RS 6n
 356 Year, including the century (for example, 1993).
 357 .RE
 358 
 359 .sp
 360 .ne 2
 361 .na
 362 \fB\fB%Z\fR\fR
 363 .ad
 364 .RS 6n
 365 Time zone name or no characters if no time zone exists.
 366 .RE
 367 
 368 .SS "Modified Conversion Specifications"
 369 .sp
 370 .LP
 371 Some conversion specifications can be modified by the \fBE\fR and \fBO\fR
 372 modifier characters to indicate that an alternate format or specification
 373 should be used rather than the one normally used by the unmodified
 374 specification. If the alternate format or specification does not exist in the
 375 current locale, the behavior will be as if the unmodified conversion
 376 specification were used.
 377 .sp
 378 .ne 2
 379 .na
 380 \fB\fB%Ec\fR\fR
 381 .ad
 382 .RS 7n
 383 Locale's alternate appropriate date and time representation.
 384 .RE
 385 
 386 .sp
 387 .ne 2
 388 .na
 389 \fB\fB%EC\fR\fR


 514 .ne 2
 515 .na
 516 \fB\fB%OW\fR\fR
 517 .ad
 518 .RS 7n
 519 Week number of the year (Monday as the first day of the week) using the
 520 locale's alternate numeric symbols.
 521 .RE
 522 
 523 .sp
 524 .ne 2
 525 .na
 526 \fB\fB%Oy\fR\fR
 527 .ad
 528 .RS 7n
 529 Year (offset from \fB%C\fR) in the locale's alternate  representation and using
 530 the locale's alternate numeric symbols.
 531 .RE
 532 
 533 .SS "General Specifications"
 534 .sp
 535 .LP
 536 A conversion specification that is an ordinary character is executed by
 537 scanning the next character from the buffer. If the character scanned from the
 538 buffer differs from the one comprising the specification, the specification
 539 fails, and the differing and subsequent characters remain unscanned.
 540 .sp
 541 .LP
 542 A series of specifications composed of \fB%n\fR, \fB%t\fR, white-space
 543 characters or any combination is executed by scanning up to the first character
 544 that is not white space (which remains unscanned), or until no more characters
 545 can be scanned.  White space is defined by \fBisspace\fR(3C).
 546 .sp
 547 .LP
 548 Any other conversion specification is executed by scanning characters until a
 549 character matching the next specification is scanned, or until no more
 550 characters can be scanned. These characters, except the one matching the next
 551 specification, are then compared to the locale values associated with the
 552 conversion specifier.  If a match is found, values for the appropriate
 553 \fItm\fR structure members are set to values corresponding to the locale
 554 information. If no match is found,  \fBstrptime()\fR fails and no more
 555 characters are scanned.
 556 .sp
 557 .LP
 558 The month names, weekday names, era names, and alternate numeric symbols can
 559 consist of any combination of upper and lower case letters.  The user can
 560 request that the input date or time specification be in a specific language by
 561 setting the \fBLC_TIME\fR category using \fBsetlocale\fR(3C).
 562 .SS "Non-zeroing Behavior"
 563 .sp
 564 .LP
 565 In addition to the behavior described above by various standards, the Solaris
 566 implementation of \fBstrptime()\fR provides the following extensions. These may
 567 change at any time in the future.  Portable applications should not depend on
 568 these extended features:
 569 .RS +4
 570 .TP
 571 .ie t \(bu
 572 .el o
 573 If \fB_STRPTIME_DONTZERO\fR is not defined, the \fBtm struct\fR is zeroed on
 574 entry and \fBstrptime()\fR updates the fields of the \fBtm struct\fR associated
 575 with the specifiers in the format string.
 576 .RE
 577 .RS +4
 578 .TP
 579 .ie t \(bu
 580 .el o
 581 If \fB_STRPTIME_DONTZERO\fR is defined, \fBstrptime()\fR does not zero the
 582 \fBtm struct\fR on entry.  Additionally, for some specifiers, \fBstrptime()\fR
 583 will use some values in the input \fBtm struct\fR to recalculate the date and
 584 re-assign the appropriate members of the \fBtm struct\fR.
 585 .RE
 586 .sp
 587 .LP
 588 The following describes extended features regardless of whether
 589 \fB_STRPTIME_DONTZERO\fR is defined or not defined:
 590 .RS +4
 591 .TP
 592 .ie t \(bu
 593 .el o
 594 If \fB%j\fR is specified, \fBtm_yday\fR is set;  if year is given, and if month
 595 and day are not given, \fBstrptime()\fR calculates and sets \fBtm_mon\fR,
 596 \fBtm_mday\fR, and \fBtm_year\fR.
 597 .RE
 598 .RS +4
 599 .TP
 600 .ie t \(bu
 601 .el o
 602 If \fB%U\fR or \fB%W\fR is specified and if weekday and year are given and
 603 month and day of month are not given, \fBstrptime()\fR calculates and sets
 604 \fBtm_mon\fR, \fBtm_mday\fR, \fBtm_wday\fR, and \fBtm_year\fR.
 605 .RE
 606 .sp
 607 .LP
 608 The following describes extended features when \fB_STRPTIME_DONTZERO\fR is not
 609 defined:
 610 .RS +4
 611 .TP
 612 .ie t \(bu
 613 .el o
 614 If \fB%C\fR is specified and \fB%y\fR is not specified, \fBstrptime()\fRassumes
 615 0 as the year offset, then calculates the year, and assigns \fBtm_year\fR.
 616 .RE
 617 .sp
 618 .LP
 619 The following describes extended features when \fB_STRPTIME_DONTZERO\fR is
 620 defined:
 621 .RS +4
 622 .TP
 623 .ie t \(bu
 624 .el o
 625 If \fB%C\fR is specified and \fB%y\fR is not specified, \fBstrptime()\fR
 626 assumes the year offset of the year value of the \fBtm_year\fR member of the
 627 input \fBtm struct\fR, then calculates the year and assigns \fBtm_year\fR.
 628 .RE
 629 .RS +4
 630 .TP
 631 .ie t \(bu
 632 .el o
 633 If \fB%j\fR is specified and neither \fB%y\fR, \fB%Y\fR, nor \fB%C\fR are
 634 specified, and neither month nor day of month are specified, \fBstrptime()\fR
 635 assumes the year value given by the value of the \fBtm_year\fR field of the
 636 input \fBtm struct\fR.  Then, in addition to setting \fBtm_yday\fR,
 637 \fBstrptime()\fR uses day-of-year and year values to calculate the month and


 643 .el o
 644 If \fB%U\fR or \fB%W\fR is specified, and if weekday and/or year are not given,
 645 and month and day of month are not given, \fBstrptime()\fR will assume the
 646 weekday value and/or the year value as the value of the \fBtm_wday\fR field
 647 and/or \fBtm_year\fR field of the input \fBtm struct\fR.  Then,
 648 \fBstrptime()\fR will calculate the month and day-of-month and assign
 649 \fBtm_month\fR, \fBtm_mday\fR, and/or \fBtm_year\fR.
 650 .RE
 651 .RS +4
 652 .TP
 653 .ie t \(bu
 654 .el o
 655 If \fB%p\fR is specified and if hour is not specified, \fBstrptime()\fR will
 656 reference, and if needed, update the \fBtm_hour\fR member. If the \fBam_pm\fR
 657 input is p.m. and the input \fBtm_hour\fR value is between 0 - 11,
 658 \fBstrptime()\fR will add 12 hours and update \fBtm_hour\fR.  If the
 659 \fBam_pm\fR input is a.m. and input \fBtm_hour\fR value is between 12 - 23,
 660 \fBstrptime()\fR will subtract 12 hours and update \fBtm_hour\fR.
 661 .RE
 662 .SH RETURN VALUES
 663 .sp
 664 .LP
 665 Upon successful completion, \fBstrptime()\fR returns a pointer to the character
 666 following the last character parsed. Otherwise, a null pointer is returned.
 667 .SH USAGE
 668 .sp
 669 .LP
 670 Several "same as" formats, and the special processing of white-space characters
 671 are provided in order to ease the use of identical  \fIformat\fR strings for
 672 \fBstrftime\fR(3C) and \fBstrptime()\fR.
 673 .sp
 674 .LP
 675 The \fBstrptime()\fR function tries to calculate \fBtm_year\fR, \fBtm_mon\fR,
 676 and \fBtm_mday\fR when given incomplete input.  This allows the \fBstruct tm\fR
 677 created by \fBstrptime()\fR to be passed to \fBmktime\fR(3C) to produce a
 678 \fBtime_t\fR value for dates and times that are representable by a
 679 \fBtime_t\fR.  As an example, since \fBmktime()\fR ignores \fBtm_yday\fR,
 680 \fBstrptime()\fR calculates \fBtm_mon\fR and \fBtm_mday\fR as well as filling
 681 in \fBtm_yday\fR when \fB%j\fR is specified without otherwise specifying a
 682 month and day within month.
 683 .SH ATTRIBUTES
 684 .sp
 685 .LP
 686 See \fBattributes\fR(5) for descriptions of the following attributes:
 687 .sp
 688 
 689 .sp
 690 .TS
 691 box;
 692 c | c
 693 l | l .
 694 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 695 _
 696 CSI     Enabled
 697 _
 698 Interface Stability     Committed
 699 _
 700 MT-Level        MT-Safe
 701 _
 702 Standard        See \fBstandards\fR(5).
 703 .TE
 704 



 705 .SH SEE ALSO
 706 .sp
 707 .LP
 708 \fBctime\fR(3C), \fBgetdate\fR(3C), \fBisspace\fR(3C), \fBmktime\fR(3C),
 709 \fBsetlocale\fR(3C), \fBstrftime\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5),


 710 \fBstandards\fR(5)
   1 '\" te
   2 .\" Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
   3 .\" Portions Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
   4 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   5 .\" http://www.opengroup.org/bookstore/.
   6 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
   7 .\"  This notice shall appear on any product containing this material.
   8 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   9 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
  10 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
  11 .TH STRPTIME 3C "Jun 27, 2014"
  12 .SH NAME
  13 strptime, strptime_l \- date and time conversion
  14 .SH SYNOPSIS
  15 .LP
  16 .nf
  17 #include <time.h>
  18 
  19 \fBchar *\fR\fBstrptime\fR(\fBconst char *restrict\fR \fIbuf\fR,
  20      \fBconst char *restrict\fR \fIformat\fR, \fBstruct tm *restrict\fR \fItm\fR);
  21 .fi
  22 .LP
  23 .nf
  24 #include <time.h>
  25 #include <xlocale.h>
  26 
  27 \fBchar *\fR\fBstrptime_l\fR(\fBconst char *restrict\fR \fIbuf\fR,
  28      \fBconst char *restrict\fR \fIformat\fR, \fBstruct tm *restrict\fR \fItm\fR,
  29      \fBlocale_t\fR \fIloc\fR);
  30 .fi

  31 .SS "Non-zeroing Behavior"
  32 .LP
  33 .nf
  34 \fBcc\fR [\fIflag\fR...]  \fIfile\fR... \fB-D_STRPTIME_DONTZERO\fR [\fIlibrary\fR...]
  35 #include <time.h>
  36 
  37 \fBchar *\fR\fBstrptime\fR(\fBconst char *restrict\fR \fIbuf\fR,
  38      \fBconst char *restrict\fR \fIformat\fR, \fBstruct tm *restrict\fR \fItm\fR);
  39 .fi
  40 
  41 .SH DESCRIPTION

  42 .LP
  43 The \fBstrptime()\fR function converts the character string pointed to by
  44 \fIbuf\fR to values which are stored in the \fBtm\fR structure pointed to by
  45 \fItm\fR, using the format specified by \fIformat\fR. The \fBstrptime_l()\fR
  46 function is identical to \fBstrptime()\fR except instead of acting in the
  47 current locale, it acts in the locale specified by the argument \fIloc\fR.

  48 .LP
  49 The \fIformat\fR argument is composed of zero or more conversion
  50 specifications. Each conversion specification is composed of a "%" (percent)
  51 character followed by one or two conversion characters which specify the
  52 replacement required. One or more white space characters (as specified by
  53 \fBisspace\fR(3C)) may precede or follow a conversion specification. There must
  54 be white-space or other non-alphanumeric characters between any two conversion
  55 specifications.

  56 .LP
  57 A non-zeroing version of \fBstrptime()\fR, described below under \fBNon-zeroing
  58 Behavior\fR, is provided if \fB_STRPTIME_DONTZERO\fR is defined.
  59 .SS "Conversion Specifications"

  60 .LP
  61 The following conversion specifications are supported:
  62 .sp
  63 .ne 2
  64 .na
  65 \fB\fB%%\fR\fR
  66 .ad
  67 .RS 6n
  68 Same as \fB%\fR.
  69 .RE
  70 
  71 .sp
  72 .ne 2
  73 .na
  74 \fB\fB%a\fR\fR
  75 .ad
  76 .RS 6n
  77 Day of week, using the locale's weekday names;  either the abbreviated or full
  78 name may be specified.
  79 .RE


 349 
 350 .sp
 351 .ne 2
 352 .na
 353 \fB\fB%Y\fR\fR
 354 .ad
 355 .RS 6n
 356 Year, including the century (for example, 1993).
 357 .RE
 358 
 359 .sp
 360 .ne 2
 361 .na
 362 \fB\fB%Z\fR\fR
 363 .ad
 364 .RS 6n
 365 Time zone name or no characters if no time zone exists.
 366 .RE
 367 
 368 .SS "Modified Conversion Specifications"

 369 .LP
 370 Some conversion specifications can be modified by the \fBE\fR and \fBO\fR
 371 modifier characters to indicate that an alternate format or specification
 372 should be used rather than the one normally used by the unmodified
 373 specification. If the alternate format or specification does not exist in the
 374 current locale, the behavior will be as if the unmodified conversion
 375 specification were used.
 376 .sp
 377 .ne 2
 378 .na
 379 \fB\fB%Ec\fR\fR
 380 .ad
 381 .RS 7n
 382 Locale's alternate appropriate date and time representation.
 383 .RE
 384 
 385 .sp
 386 .ne 2
 387 .na
 388 \fB\fB%EC\fR\fR


 513 .ne 2
 514 .na
 515 \fB\fB%OW\fR\fR
 516 .ad
 517 .RS 7n
 518 Week number of the year (Monday as the first day of the week) using the
 519 locale's alternate numeric symbols.
 520 .RE
 521 
 522 .sp
 523 .ne 2
 524 .na
 525 \fB\fB%Oy\fR\fR
 526 .ad
 527 .RS 7n
 528 Year (offset from \fB%C\fR) in the locale's alternate  representation and using
 529 the locale's alternate numeric symbols.
 530 .RE
 531 
 532 .SS "General Specifications"

 533 .LP
 534 A conversion specification that is an ordinary character is executed by
 535 scanning the next character from the buffer. If the character scanned from the
 536 buffer differs from the one comprising the specification, the specification
 537 fails, and the differing and subsequent characters remain unscanned.
 538 .sp
 539 .LP
 540 A series of specifications composed of \fB%n\fR, \fB%t\fR, white-space
 541 characters or any combination is executed by scanning up to the first character
 542 that is not white space (which remains unscanned), or until no more characters
 543 can be scanned.  White space is defined by \fBisspace\fR(3C).

 544 .LP
 545 Any other conversion specification is executed by scanning characters until a
 546 character matching the next specification is scanned, or until no more
 547 characters can be scanned. These characters, except the one matching the next
 548 specification, are then compared to the locale values associated with the
 549 conversion specifier.  If a match is found, values for the appropriate
 550 \fItm\fR structure members are set to values corresponding to the locale
 551 information. If no match is found,  \fBstrptime()\fR fails and no more
 552 characters are scanned.
 553 .sp
 554 .LP
 555 The month names, weekday names, era names, and alternate numeric symbols can
 556 consist of any combination of upper and lower case letters.  The user can
 557 request that the input date or time specification be in a specific language by
 558 setting the \fBLC_TIME\fR category using \fBsetlocale\fR(3C).
 559 .SS "Non-zeroing Behavior"

 560 .LP
 561 In addition to the behavior described above by various standards, the Solaris
 562 implementation of \fBstrptime()\fR provides the following extensions. These may
 563 change at any time in the future.  Portable applications should not depend on
 564 these extended features:
 565 .RS +4
 566 .TP
 567 .ie t \(bu
 568 .el o
 569 If \fB_STRPTIME_DONTZERO\fR is not defined, the \fBtm struct\fR is zeroed on
 570 entry and \fBstrptime()\fR updates the fields of the \fBtm struct\fR associated
 571 with the specifiers in the format string.
 572 .RE
 573 .RS +4
 574 .TP
 575 .ie t \(bu
 576 .el o
 577 If \fB_STRPTIME_DONTZERO\fR is defined, \fBstrptime()\fR does not zero the
 578 \fBtm struct\fR on entry.  Additionally, for some specifiers, \fBstrptime()\fR
 579 will use some values in the input \fBtm struct\fR to recalculate the date and
 580 re-assign the appropriate members of the \fBtm struct\fR.
 581 .RE

 582 .LP
 583 The following describes extended features regardless of whether
 584 \fB_STRPTIME_DONTZERO\fR is defined or not defined:
 585 .RS +4
 586 .TP
 587 .ie t \(bu
 588 .el o
 589 If \fB%j\fR is specified, \fBtm_yday\fR is set;  if year is given, and if month
 590 and day are not given, \fBstrptime()\fR calculates and sets \fBtm_mon\fR,
 591 \fBtm_mday\fR, and \fBtm_year\fR.
 592 .RE
 593 .RS +4
 594 .TP
 595 .ie t \(bu
 596 .el o
 597 If \fB%U\fR or \fB%W\fR is specified and if weekday and year are given and
 598 month and day of month are not given, \fBstrptime()\fR calculates and sets
 599 \fBtm_mon\fR, \fBtm_mday\fR, \fBtm_wday\fR, and \fBtm_year\fR.
 600 .RE

 601 .LP
 602 The following describes extended features when \fB_STRPTIME_DONTZERO\fR is not
 603 defined:
 604 .RS +4
 605 .TP
 606 .ie t \(bu
 607 .el o
 608 If \fB%C\fR is specified and \fB%y\fR is not specified, \fBstrptime()\fRassumes
 609 0 as the year offset, then calculates the year, and assigns \fBtm_year\fR.
 610 .RE

 611 .LP
 612 The following describes extended features when \fB_STRPTIME_DONTZERO\fR is
 613 defined:
 614 .RS +4
 615 .TP
 616 .ie t \(bu
 617 .el o
 618 If \fB%C\fR is specified and \fB%y\fR is not specified, \fBstrptime()\fR
 619 assumes the year offset of the year value of the \fBtm_year\fR member of the
 620 input \fBtm struct\fR, then calculates the year and assigns \fBtm_year\fR.
 621 .RE
 622 .RS +4
 623 .TP
 624 .ie t \(bu
 625 .el o
 626 If \fB%j\fR is specified and neither \fB%y\fR, \fB%Y\fR, nor \fB%C\fR are
 627 specified, and neither month nor day of month are specified, \fBstrptime()\fR
 628 assumes the year value given by the value of the \fBtm_year\fR field of the
 629 input \fBtm struct\fR.  Then, in addition to setting \fBtm_yday\fR,
 630 \fBstrptime()\fR uses day-of-year and year values to calculate the month and


 636 .el o
 637 If \fB%U\fR or \fB%W\fR is specified, and if weekday and/or year are not given,
 638 and month and day of month are not given, \fBstrptime()\fR will assume the
 639 weekday value and/or the year value as the value of the \fBtm_wday\fR field
 640 and/or \fBtm_year\fR field of the input \fBtm struct\fR.  Then,
 641 \fBstrptime()\fR will calculate the month and day-of-month and assign
 642 \fBtm_month\fR, \fBtm_mday\fR, and/or \fBtm_year\fR.
 643 .RE
 644 .RS +4
 645 .TP
 646 .ie t \(bu
 647 .el o
 648 If \fB%p\fR is specified and if hour is not specified, \fBstrptime()\fR will
 649 reference, and if needed, update the \fBtm_hour\fR member. If the \fBam_pm\fR
 650 input is p.m. and the input \fBtm_hour\fR value is between 0 - 11,
 651 \fBstrptime()\fR will add 12 hours and update \fBtm_hour\fR.  If the
 652 \fBam_pm\fR input is a.m. and input \fBtm_hour\fR value is between 12 - 23,
 653 \fBstrptime()\fR will subtract 12 hours and update \fBtm_hour\fR.
 654 .RE
 655 .SH RETURN VALUES

 656 .LP
 657 Upon successful completion, \fBstrptime()\fR returns a pointer to the character
 658 following the last character parsed. Otherwise, a null pointer is returned.
 659 .SH USAGE

 660 .LP
 661 Several "same as" formats, and the special processing of white-space characters
 662 are provided in order to ease the use of identical  \fIformat\fR strings for
 663 \fBstrftime\fR(3C) and \fBstrptime()\fR.

 664 .LP
 665 The \fBstrptime()\fR function tries to calculate \fBtm_year\fR, \fBtm_mon\fR,
 666 and \fBtm_mday\fR when given incomplete input.  This allows the \fBstruct tm\fR
 667 created by \fBstrptime()\fR to be passed to \fBmktime\fR(3C) to produce a
 668 \fBtime_t\fR value for dates and times that are representable by a
 669 \fBtime_t\fR.  As an example, since \fBmktime()\fR ignores \fBtm_yday\fR,
 670 \fBstrptime()\fR calculates \fBtm_mon\fR and \fBtm_mday\fR as well as filling
 671 in \fBtm_yday\fR when \fB%j\fR is specified without otherwise specifying a
 672 month and day within month.
 673 .SH ATTRIBUTES

 674 .LP
 675 See \fBattributes\fR(5) for descriptions of the following attributes:



 676 .TS
 677 box;
 678 c | c
 679 l | l .
 680 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 681 _
 682 CSI     Enabled
 683 _
 684 Interface Stability     See below.
 685 _
 686 MT-Level        MT-Safe
 687 _
 688 Standard        See \fBstandards\fR(5) for \fBstrptime()\fR.
 689 .TE
 690 
 691 .LP
 692 The \fBstrptime()\fR function is Standard.  The \fBstrptime_l()\fR function
 693 is Uncommitted.
 694 .SH SEE ALSO

 695 .LP
 696 \fBctime\fR(3C), \fBgetdate\fR(3C), \fBisspace\fR(3C), \fBmktime\fR(3C),
 697 \fBnewlocale\fR(3C),
 698 \fBsetlocale\fR(3C), \fBstrftime\fR(3C), \fBuselocale\fR(3C),
 699 \fBattributes\fR(5), \fBenviron\fR(5),
 700 \fBstandards\fR(5)