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 \- 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
23 .SS "Non-zeroing Behavior"
24 .LP
25 .nf
26 \fBcc\fR [\fIflag\fR...] \fIfile\fR... \fB-D_STRPTIME_DONTZERO\fR [\fIlibrary\fR...]
27 #include <time.h>
28
29 \fBchar *\fR\fBstrptime\fR(\fBconst char *restrict\fR \fIbuf\fR,
30 \fBconst char *restrict\fR \fIformat\fR, \fBstruct tm *restrict\fR \fItm\fR);
31 .fi
32
33 .SH DESCRIPTION
34 .sp
35 .LP
36 The \fBstrptime()\fR function converts the character string pointed to by
37 \fIbuf\fR to values which are stored in the \fBtm\fR structure pointed to by
38 \fItm\fR, using the format specified by \fIformat\fR.
39 .sp
40 .LP
41 The \fIformat\fR argument is composed of zero or more conversion
42 specifications. Each conversion specification is composed of a "%" (percent)
43 character followed by one or two conversion characters which specify the
44 replacement required. One or more white space characters (as specified by
45 \fBisspace\fR(3C)) may precede or follow a conversion specification. There must
46 be white-space or other non-alphanumeric characters between any two conversion
47 specifications.
48 .sp
49 .LP
50 A non-zeroing version of \fBstrptime()\fR, described below under \fBNon-zeroing
51 Behavior\fR, is provided if \fB_STRPTIME_DONTZERO\fR is defined.
52 .SS "Conversion Specifications"
53 .sp
54 .LP
55 The following conversion specifications are supported:
56 .sp
57 .ne 2
58 .na
59 \fB\fB%%\fR\fR
60 .ad
61 .RS 6n
62 Same as \fB%\fR.
63 .RE
64
65 .sp
66 .ne 2
67 .na
68 \fB\fB%a\fR\fR
69 .ad
70 .RS 6n
71 Day of week, using the locale's weekday names; either the abbreviated or full
72 name may be specified.
73 .RE
343
344 .sp
345 .ne 2
346 .na
347 \fB\fB%Y\fR\fR
348 .ad
349 .RS 6n
350 Year, including the century (for example, 1993).
351 .RE
352
353 .sp
354 .ne 2
355 .na
356 \fB\fB%Z\fR\fR
357 .ad
358 .RS 6n
359 Time zone name or no characters if no time zone exists.
360 .RE
361
362 .SS "Modified Conversion Specifications"
363 .sp
364 .LP
365 Some conversion specifications can be modified by the \fBE\fR and \fBO\fR
366 modifier characters to indicate that an alternate format or specification
367 should be used rather than the one normally used by the unmodified
368 specification. If the alternate format or specification does not exist in the
369 current locale, the behavior will be as if the unmodified conversion
370 specification were used.
371 .sp
372 .ne 2
373 .na
374 \fB\fB%Ec\fR\fR
375 .ad
376 .RS 7n
377 Locale's alternate appropriate date and time representation.
378 .RE
379
380 .sp
381 .ne 2
382 .na
383 \fB\fB%EC\fR\fR
508 .ne 2
509 .na
510 \fB\fB%OW\fR\fR
511 .ad
512 .RS 7n
513 Week number of the year (Monday as the first day of the week) using the
514 locale's alternate numeric symbols.
515 .RE
516
517 .sp
518 .ne 2
519 .na
520 \fB\fB%Oy\fR\fR
521 .ad
522 .RS 7n
523 Year (offset from \fB%C\fR) in the locale's alternate representation and using
524 the locale's alternate numeric symbols.
525 .RE
526
527 .SS "General Specifications"
528 .sp
529 .LP
530 A conversion specification that is an ordinary character is executed by
531 scanning the next character from the buffer. If the character scanned from the
532 buffer differs from the one comprising the specification, the specification
533 fails, and the differing and subsequent characters remain unscanned.
534 .sp
535 .LP
536 A series of specifications composed of \fB%n\fR, \fB%t\fR, white-space
537 characters or any combination is executed by scanning up to the first character
538 that is not white space (which remains unscanned), or until no more characters
539 can be scanned. White space is defined by \fBisspace\fR(3C).
540 .sp
541 .LP
542 Any other conversion specification is executed by scanning characters until a
543 character matching the next specification is scanned, or until no more
544 characters can be scanned. These characters, except the one matching the next
545 specification, are then compared to the locale values associated with the
546 conversion specifier. If a match is found, values for the appropriate
547 \fItm\fR structure members are set to values corresponding to the locale
548 information. If no match is found, \fBstrptime()\fR fails and no more
549 characters are scanned.
550 .sp
551 .LP
552 The month names, weekday names, era names, and alternate numeric symbols can
553 consist of any combination of upper and lower case letters. The user can
554 request that the input date or time specification be in a specific language by
555 setting the \fBLC_TIME\fR category using \fBsetlocale\fR(3C).
556 .SS "Non-zeroing Behavior"
557 .sp
558 .LP
559 In addition to the behavior described above by various standards, the Solaris
560 implementation of \fBstrptime()\fR provides the following extensions. These may
561 change at any time in the future. Portable applications should not depend on
562 these extended features:
563 .RS +4
564 .TP
565 .ie t \(bu
566 .el o
567 If \fB_STRPTIME_DONTZERO\fR is not defined, the \fBtm struct\fR is zeroed on
568 entry and \fBstrptime()\fR updates the fields of the \fBtm struct\fR associated
569 with the specifiers in the format string.
570 .RE
571 .RS +4
572 .TP
573 .ie t \(bu
574 .el o
575 If \fB_STRPTIME_DONTZERO\fR is defined, \fBstrptime()\fR does not zero the
576 \fBtm struct\fR on entry. Additionally, for some specifiers, \fBstrptime()\fR
577 will use some values in the input \fBtm struct\fR to recalculate the date and
578 re-assign the appropriate members of the \fBtm struct\fR.
579 .RE
580 .sp
581 .LP
582 The following describes extended features regardless of whether
583 \fB_STRPTIME_DONTZERO\fR is defined or not defined:
584 .RS +4
585 .TP
586 .ie t \(bu
587 .el o
588 If \fB%j\fR is specified, \fBtm_yday\fR is set; if year is given, and if month
589 and day are not given, \fBstrptime()\fR calculates and sets \fBtm_mon\fR,
590 \fBtm_mday\fR, and \fBtm_year\fR.
591 .RE
592 .RS +4
593 .TP
594 .ie t \(bu
595 .el o
596 If \fB%U\fR or \fB%W\fR is specified and if weekday and year are given and
597 month and day of month are not given, \fBstrptime()\fR calculates and sets
598 \fBtm_mon\fR, \fBtm_mday\fR, \fBtm_wday\fR, and \fBtm_year\fR.
599 .RE
600 .sp
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 .sp
612 .LP
613 The following describes extended features when \fB_STRPTIME_DONTZERO\fR is
614 defined:
615 .RS +4
616 .TP
617 .ie t \(bu
618 .el o
619 If \fB%C\fR is specified and \fB%y\fR is not specified, \fBstrptime()\fR
620 assumes the year offset of the year value of the \fBtm_year\fR member of the
621 input \fBtm struct\fR, then calculates the year and assigns \fBtm_year\fR.
622 .RE
623 .RS +4
624 .TP
625 .ie t \(bu
626 .el o
627 If \fB%j\fR is specified and neither \fB%y\fR, \fB%Y\fR, nor \fB%C\fR are
628 specified, and neither month nor day of month are specified, \fBstrptime()\fR
629 assumes the year value given by the value of the \fBtm_year\fR field of the
630 input \fBtm struct\fR. Then, in addition to setting \fBtm_yday\fR,
631 \fBstrptime()\fR uses day-of-year and year values to calculate the month and
637 .el o
638 If \fB%U\fR or \fB%W\fR is specified, and if weekday and/or year are not given,
639 and month and day of month are not given, \fBstrptime()\fR will assume the
640 weekday value and/or the year value as the value of the \fBtm_wday\fR field
641 and/or \fBtm_year\fR field of the input \fBtm struct\fR. Then,
642 \fBstrptime()\fR will calculate the month and day-of-month and assign
643 \fBtm_month\fR, \fBtm_mday\fR, and/or \fBtm_year\fR.
644 .RE
645 .RS +4
646 .TP
647 .ie t \(bu
648 .el o
649 If \fB%p\fR is specified and if hour is not specified, \fBstrptime()\fR will
650 reference, and if needed, update the \fBtm_hour\fR member. If the \fBam_pm\fR
651 input is p.m. and the input \fBtm_hour\fR value is between 0 - 11,
652 \fBstrptime()\fR will add 12 hours and update \fBtm_hour\fR. If the
653 \fBam_pm\fR input is a.m. and input \fBtm_hour\fR value is between 12 - 23,
654 \fBstrptime()\fR will subtract 12 hours and update \fBtm_hour\fR.
655 .RE
656 .SH RETURN VALUES
657 .sp
658 .LP
659 Upon successful completion, \fBstrptime()\fR returns a pointer to the character
660 following the last character parsed. Otherwise, a null pointer is returned.
661 .SH USAGE
662 .sp
663 .LP
664 Several "same as" formats, and the special processing of white-space characters
665 are provided in order to ease the use of identical \fIformat\fR strings for
666 \fBstrftime\fR(3C) and \fBstrptime()\fR.
667 .sp
668 .LP
669 The \fBstrptime()\fR function tries to calculate \fBtm_year\fR, \fBtm_mon\fR,
670 and \fBtm_mday\fR when given incomplete input. This allows the \fBstruct tm\fR
671 created by \fBstrptime()\fR to be passed to \fBmktime\fR(3C) to produce a
672 \fBtime_t\fR value for dates and times that are representable by a
673 \fBtime_t\fR. As an example, since \fBmktime()\fR ignores \fBtm_yday\fR,
674 \fBstrptime()\fR calculates \fBtm_mon\fR and \fBtm_mday\fR as well as filling
675 in \fBtm_yday\fR when \fB%j\fR is specified without otherwise specifying a
676 month and day within month.
677 .SH ATTRIBUTES
678 .sp
679 .LP
680 See \fBattributes\fR(5) for descriptions of the following attributes:
681 .sp
682
683 .sp
684 .TS
685 box;
686 c | c
687 l | l .
688 ATTRIBUTE TYPE ATTRIBUTE VALUE
689 _
690 CSI Enabled
691 _
692 Interface Stability Committed
693 _
694 MT-Level MT-Safe
695 _
696 Standard See \fBstandards\fR(5).
697 .TE
698
699 .SH SEE ALSO
700 .sp
701 .LP
702 \fBctime\fR(3C), \fBgetdate\fR(3C), \fBisspace\fR(3C), \fBmktime\fR(3C),
703 \fBsetlocale\fR(3C), \fBstrftime\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5),
704 \fBstandards\fR(5)
|
1 '\" te
2 .\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
3 .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
4 .\" Portions Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
5 .\" 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
6 .\" http://www.opengroup.org/bookstore/.
7 .\" 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.
8 .\" This notice shall appear on any product containing this material.
9 .\" 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.
10 .\" 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.
11 .\" 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]
12 .TH STRPTIME 3C "Jun 27, 2014"
13 .SH NAME
14 strptime, strptime_l \- date and time conversion
15 .SH SYNOPSIS
16 .LP
17 .nf
18 #include <time.h>
19
20 \fBchar *\fR\fBstrptime\fR(\fBconst char *restrict\fR \fIbuf\fR,
21 \fBconst char *restrict\fR \fIformat\fR, \fBstruct tm *restrict\fR \fItm\fR);
22 .fi
23 .LP
24 .nf
25 #include <time.h>
26 #include <xlocale.h>
27
28 \fBchar *\fR\fBstrptime_l\fR(\fBconst char *restrict\fR \fIbuf\fR,
29 \fBconst char *restrict\fR \fIformat\fR, \fBstruct tm *restrict\fR \fItm\fR,
30 \fBlocale_t\fR \fIloc\fR);
31 .fi
32 .SS "Non-zeroing Behavior"
33 .LP
34 .nf
35 \fBcc\fR [\fIflag\fR...] \fIfile\fR... \fB-D_STRPTIME_DONTZERO\fR [\fIlibrary\fR...]
36 #include <time.h>
37
38 \fBchar *\fR\fBstrptime\fR(\fBconst char *restrict\fR \fIbuf\fR,
39 \fBconst char *restrict\fR \fIformat\fR, \fBstruct tm *restrict\fR \fItm\fR);
40 .fi
41
42 .SH DESCRIPTION
43 .LP
44 The \fBstrptime()\fR function converts the character string pointed to by
45 \fIbuf\fR to values which are stored in the \fBtm\fR structure pointed to by
46 \fItm\fR, using the format specified by \fIformat\fR. The \fBstrptime_l()\fR
47 function is identical to \fBstrptime()\fR except instead of acting in the
48 current locale, it acts in the locale specified by the argument \fIloc\fR.
49 .LP
50 The \fIformat\fR argument is composed of zero or more conversion
51 specifications. Each conversion specification is composed of a "%" (percent)
52 character followed by one or two conversion characters which specify the
53 replacement required. One or more white space characters (as specified by
54 \fBisspace\fR(3C)) may precede or follow a conversion specification. There must
55 be white-space or other non-alphanumeric characters between any two conversion
56 specifications.
57 .LP
58 A non-zeroing version of \fBstrptime()\fR, described below under \fBNon-zeroing
59 Behavior\fR, is provided if \fB_STRPTIME_DONTZERO\fR is defined.
60 .SS "Conversion Specifications"
61 .LP
62 The following conversion specifications are supported:
63 .sp
64 .ne 2
65 .na
66 \fB\fB%%\fR\fR
67 .ad
68 .RS 6n
69 Same as \fB%\fR.
70 .RE
71
72 .sp
73 .ne 2
74 .na
75 \fB\fB%a\fR\fR
76 .ad
77 .RS 6n
78 Day of week, using the locale's weekday names; either the abbreviated or full
79 name may be specified.
80 .RE
350
351 .sp
352 .ne 2
353 .na
354 \fB\fB%Y\fR\fR
355 .ad
356 .RS 6n
357 Year, including the century (for example, 1993).
358 .RE
359
360 .sp
361 .ne 2
362 .na
363 \fB\fB%Z\fR\fR
364 .ad
365 .RS 6n
366 Time zone name or no characters if no time zone exists.
367 .RE
368
369 .SS "Modified Conversion Specifications"
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 .LP
535 A conversion specification that is an ordinary character is executed by
536 scanning the next character from the buffer. If the character scanned from the
537 buffer differs from the one comprising the specification, the specification
538 fails, and the differing and subsequent characters remain unscanned.
539 .sp
540 .LP
541 A series of specifications composed of \fB%n\fR, \fB%t\fR, white-space
542 characters or any combination is executed by scanning up to the first character
543 that is not white space (which remains unscanned), or until no more characters
544 can be scanned. White space is defined by \fBisspace\fR(3C).
545 .LP
546 Any other conversion specification is executed by scanning characters until a
547 character matching the next specification is scanned, or until no more
548 characters can be scanned. These characters, except the one matching the next
549 specification, are then compared to the locale values associated with the
550 conversion specifier. If a match is found, values for the appropriate
551 \fItm\fR structure members are set to values corresponding to the locale
552 information. If no match is found, \fBstrptime()\fR fails and no more
553 characters are scanned.
554 .sp
555 .LP
556 The month names, weekday names, era names, and alternate numeric symbols can
557 consist of any combination of upper and lower case letters. The user can
558 request that the input date or time specification be in a specific language by
559 setting the \fBLC_TIME\fR category using \fBsetlocale\fR(3C).
560 .SS "Non-zeroing Behavior"
561 .LP
562 In addition to the behavior described above by various standards, the Solaris
563 implementation of \fBstrptime()\fR provides the following extensions. These may
564 change at any time in the future. Portable applications should not depend on
565 these extended features:
566 .RS +4
567 .TP
568 .ie t \(bu
569 .el o
570 If \fB_STRPTIME_DONTZERO\fR is not defined, the \fBtm struct\fR is zeroed on
571 entry and \fBstrptime()\fR updates the fields of the \fBtm struct\fR associated
572 with the specifiers in the format string.
573 .RE
574 .RS +4
575 .TP
576 .ie t \(bu
577 .el o
578 If \fB_STRPTIME_DONTZERO\fR is defined, \fBstrptime()\fR does not zero the
579 \fBtm struct\fR on entry. Additionally, for some specifiers, \fBstrptime()\fR
580 will use some values in the input \fBtm struct\fR to recalculate the date and
581 re-assign the appropriate members of the \fBtm struct\fR.
582 .RE
583 .LP
584 The following describes extended features regardless of whether
585 \fB_STRPTIME_DONTZERO\fR is defined or not defined:
586 .RS +4
587 .TP
588 .ie t \(bu
589 .el o
590 If \fB%j\fR is specified, \fBtm_yday\fR is set; if year is given, and if month
591 and day are not given, \fBstrptime()\fR calculates and sets \fBtm_mon\fR,
592 \fBtm_mday\fR, and \fBtm_year\fR.
593 .RE
594 .RS +4
595 .TP
596 .ie t \(bu
597 .el o
598 If \fB%U\fR or \fB%W\fR is specified and if weekday and year are given and
599 month and day of month are not given, \fBstrptime()\fR calculates and sets
600 \fBtm_mon\fR, \fBtm_mday\fR, \fBtm_wday\fR, and \fBtm_year\fR.
601 .RE
602 .LP
603 The following describes extended features when \fB_STRPTIME_DONTZERO\fR is not
604 defined:
605 .RS +4
606 .TP
607 .ie t \(bu
608 .el o
609 If \fB%C\fR is specified and \fB%y\fR is not specified, \fBstrptime()\fRassumes
610 0 as the year offset, then calculates the year, and assigns \fBtm_year\fR.
611 .RE
612 .LP
613 The following describes extended features when \fB_STRPTIME_DONTZERO\fR is
614 defined:
615 .RS +4
616 .TP
617 .ie t \(bu
618 .el o
619 If \fB%C\fR is specified and \fB%y\fR is not specified, \fBstrptime()\fR
620 assumes the year offset of the year value of the \fBtm_year\fR member of the
621 input \fBtm struct\fR, then calculates the year and assigns \fBtm_year\fR.
622 .RE
623 .RS +4
624 .TP
625 .ie t \(bu
626 .el o
627 If \fB%j\fR is specified and neither \fB%y\fR, \fB%Y\fR, nor \fB%C\fR are
628 specified, and neither month nor day of month are specified, \fBstrptime()\fR
629 assumes the year value given by the value of the \fBtm_year\fR field of the
630 input \fBtm struct\fR. Then, in addition to setting \fBtm_yday\fR,
631 \fBstrptime()\fR uses day-of-year and year values to calculate the month and
637 .el o
638 If \fB%U\fR or \fB%W\fR is specified, and if weekday and/or year are not given,
639 and month and day of month are not given, \fBstrptime()\fR will assume the
640 weekday value and/or the year value as the value of the \fBtm_wday\fR field
641 and/or \fBtm_year\fR field of the input \fBtm struct\fR. Then,
642 \fBstrptime()\fR will calculate the month and day-of-month and assign
643 \fBtm_month\fR, \fBtm_mday\fR, and/or \fBtm_year\fR.
644 .RE
645 .RS +4
646 .TP
647 .ie t \(bu
648 .el o
649 If \fB%p\fR is specified and if hour is not specified, \fBstrptime()\fR will
650 reference, and if needed, update the \fBtm_hour\fR member. If the \fBam_pm\fR
651 input is p.m. and the input \fBtm_hour\fR value is between 0 - 11,
652 \fBstrptime()\fR will add 12 hours and update \fBtm_hour\fR. If the
653 \fBam_pm\fR input is a.m. and input \fBtm_hour\fR value is between 12 - 23,
654 \fBstrptime()\fR will subtract 12 hours and update \fBtm_hour\fR.
655 .RE
656 .SH RETURN VALUES
657 .LP
658 Upon successful completion, \fBstrptime()\fR returns a pointer to the character
659 following the last character parsed. Otherwise, a null pointer is returned.
660 .SH USAGE
661 .LP
662 Several "same as" formats, and the special processing of white-space characters
663 are provided in order to ease the use of identical \fIformat\fR strings for
664 \fBstrftime\fR(3C) and \fBstrptime()\fR.
665 .LP
666 The \fBstrptime()\fR function tries to calculate \fBtm_year\fR, \fBtm_mon\fR,
667 and \fBtm_mday\fR when given incomplete input. This allows the \fBstruct tm\fR
668 created by \fBstrptime()\fR to be passed to \fBmktime\fR(3C) to produce a
669 \fBtime_t\fR value for dates and times that are representable by a
670 \fBtime_t\fR. As an example, since \fBmktime()\fR ignores \fBtm_yday\fR,
671 \fBstrptime()\fR calculates \fBtm_mon\fR and \fBtm_mday\fR as well as filling
672 in \fBtm_yday\fR when \fB%j\fR is specified without otherwise specifying a
673 month and day within month.
674 .SH ATTRIBUTES
675 .LP
676 See \fBattributes\fR(5) for descriptions of the following attributes:
677 .TS
678 box;
679 c | c
680 l | l .
681 ATTRIBUTE TYPE ATTRIBUTE VALUE
682 _
683 CSI Enabled
684 _
685 Interface Stability See below.
686 _
687 MT-Level MT-Safe
688 _
689 Standard See \fBstandards\fR(5) for \fBstrptime()\fR.
690 .TE
691
692 .LP
693 The \fBstrptime()\fR function is Standard. The \fBstrptime_l()\fR function
694 is Uncommitted.
695 .SH SEE ALSO
696 .LP
697 \fBctime\fR(3C), \fBgetdate\fR(3C), \fBisspace\fR(3C), \fBmktime\fR(3C),
698 \fBnewlocale\fR(3C),
699 \fBsetlocale\fR(3C), \fBstrftime\fR(3C), \fBuselocale\fR(3C),
700 \fBattributes\fR(5), \fBenviron\fR(5),
701 \fBstandards\fR(5)
|