POSIX::strptime(3pm)

POSIX::strptime3pm

Perl extension to the posix date parsing strptime(3) function

Usage

 ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = POSIX::strptime("string", "Format");

Overview

Perl interface to strptime(3)

Functions

strptime
 ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = POSIX::strptime(string, format);

The result for any value not extracted is not defined. Some platforms may reliably return "undef", but this is dependent on the strptime(3) function in the underlying C library.

For example, only the following fields may be relied upon:

 my ($min, $hour) = ( POSIX::strptime( "01:23", '%H:%M' ) )[1,2];
 
 my ($mday, $mon, $year) = ( POSIX::strptime( "2010/07/16", '%Y/%m/%d' ) )[3,4,5];

Furthermore, not all platforms will set the $wday and $yday elements. If these values are required, use "mktime" and "gmtime":

 use POSIX qw( mktime );
 use POSIX::strptime qw( strptime );
 my ($mday, $mon, $year) = ( POSIX::strptime( "2010/07/16", '%Y/%m/%d' ) )[3,4,5];
 my $wday = ( gmtime mktime 0, 0, 0, $mday, $mon, $year )[6];

Repository

http://svn.ectoplasm.org/projects/perl/POSIX-strptime/trunk/

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 7 times.

  1. 6.0
  2. 7
  3. 8
  4. 9
  5. 10
  6. 11
  7. 12
  8. 13

Author

Philippe M. Chiasson <[email protected]> Kim Scheibel <[email protected]>

From libposix-strptime-perl 0.13-2+b4 in Debian 13 (Trixie). Parsed by carta from the page's man source.