POSIX::strptime - Perl extension to the POSIX date parsing strptime(3) function


POSIX-strptime documentation Contained in the POSIX-strptime distribution.

Index


Code Index:

NAME

Top

POSIX::strptime - Perl extension to the POSIX date parsing strptime(3) function

SYNOPSIS

Top

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

DESCRIPTION

Top

Perl interface to strptime(3)

FUNCTIONS

Top

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];

SEE ALSO

Top

strptime(3)

AUTHOR

Top

Philippe M. Chiasson <gozer@cpan.org> Kim Scheibel <kim@scheibel.co.uk>

REPOSITORY

Top

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

COPYRIGHT

Top


POSIX-strptime documentation Contained in the POSIX-strptime distribution.

package POSIX::strptime;

use 5.000;
use strict;

use XSLoader;
use vars qw($VERSION @ISA @EXPORT_OK);

$VERSION = '0.10';

require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(strptime);

XSLoader::load __PACKAGE__, $VERSION;

if (not defined &POSIX::strptime) {
    *POSIX::strptime = \&strptime;
}

# Preloaded methods go here.

1;
__END__