.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "POSIX::strptime 3pm" .TH POSIX::strptime 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME POSIX::strptime \- Perl extension to the POSIX date parsing strptime(3) function .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = POSIX::strptime("string", "Format"); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Perl interface to \fBstrptime\fR\|(3) .SH FUNCTIONS .IX Header "FUNCTIONS" .IP strptime 4 .IX Item "strptime" .Vb 1 \& ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = POSIX::strptime(string, format); .Ve .Sp The result for any value not extracted is not defined. Some platforms may reliably return \f(CW\*(C`undef\*(C'\fR, but this is dependent on the \f(CWstrptime(3)\fR function in the underlying C library. .Sp For example, only the following fields may be relied upon: .Sp .Vb 1 \& my ($min, $hour) = ( POSIX::strptime( "01:23", \*(Aq%H:%M\*(Aq ) )[1,2]; \& \& my ($mday, $mon, $year) = ( POSIX::strptime( "2010/07/16", \*(Aq%Y/%m/%d\*(Aq ) )[3,4,5]; .Ve .Sp Furthermore, not all platforms will set the \f(CW$wday\fR and \f(CW$yday\fR elements. If these values are required, use \f(CW\*(C`mktime\*(C'\fR and \f(CW\*(C`gmtime\*(C'\fR: .Sp .Vb 2 \& use POSIX qw( mktime ); \& use POSIX::strptime qw( strptime ); \& \& my ($mday, $mon, $year) = ( POSIX::strptime( "2010/07/16", \*(Aq%Y/%m/%d\*(Aq ) )[3,4,5]; \& my $wday = ( gmtime mktime 0, 0, 0, $mday, $mon, $year )[6]; .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBstrptime\fR\|(3) .SH AUTHOR .IX Header "AUTHOR" Philippe M. Chiasson Kim Scheibel .SH REPOSITORY .IX Header "REPOSITORY" http://svn.ectoplasm.org/projects/perl/POSIX\-strptime/trunk/ .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright 2005 by Philippe M. Chiasson . .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP See \fIhttp://www.perl.com/perl/misc/Artistic.html\fR