1POSIX::strptime(3) User Contributed Perl Documentation POSIX::strptime(3)
2
3
4
6 POSIX::strptime - Perl extension to the POSIX date parsing strptime(3)
7 function
8
10 ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = POSIX::strptime("string", "Format");
11
13 Perl interface to strptime(3)
14
16 strptime
17 ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = POSIX::strptime(string, format);
18
19 The result for any value not extracted is not defined. Some
20 platforms may reliably return "undef", but this is dependent on the
21 strptime(3) function in the underlying C library.
22
23 For example, only the following fields may be relied upon:
24
25 my ($min, $hour) = ( POSIX::strptime( "01:23", '%H:%M' ) )[1,2];
26
27 my ($mday, $mon, $year) = ( POSIX::strptime( "2010/07/16", '%Y/%m/%d' ) )[3,4,5];
28
29 Furthermore, not all platforms will set the $wday and $yday
30 elements. If these values are required, use "mktime" and "gmtime":
31
32 use POSIX qw( mktime );
33 use POSIX::strptime qw( strptime );
34
35 my ($mday, $mon, $year) = ( POSIX::strptime( "2010/07/16", '%Y/%m/%d' ) )[3,4,5];
36 my $wday = ( gmtime mktime 0, 0, 0, $mday, $mon, $year )[6];
37
39 strptime(3)
40
42 Philippe M. Chiasson <gozer@cpan.org> Kim Scheibel <kim@scheibel.co.uk>
43
45 http://svn.ectoplasm.org/projects/perl/POSIX-strptime/trunk/
46
48 Copyright 2005 by Philippe M. Chiasson <gozer@cpan.org>.
49
50 This program is free software; you can redistribute it and/or modify it
51 under the same terms as Perl itself.
52
53 See http://www.perl.com/perl/misc/Artistic.html
54
55
56
57perl v5.34.0 2022-01-21 POSIX::strptime(3)