SPVM::Time::Local - Reverse Manipulation of localtime and gmtime Functions.
use Time use Time::Local; my $epoch = Time->time; my $time_info_local = Time->localtime($epoch); my $time_info_utc = Time->gmtime($epoch); # Convert a Time::Info object that is local time to the epoch time my $epoch = Time::Local->timelocal($time_info_local); # Convert a Time::Info object that is UTC to the epoch time my $epoch = Time::Local->timegm($time_info_utc);
Time::Local provides reverse manipulations of localtime and gmtime functions.
Time::Local
static method timelocal : long ($time_info : Time::Info)
Convert a Time::Info object that is local time to the epoch time.
This method is the reverse manipulation of localtime.
This method is the same as timelocal function of Linux.
timelocal
Linux
my $epoch = Time::Local->timelocal($time_info_local);
static method timegm : long ($time_info : Time::Info)
Convert a Time::Info object that is UTC to the epoch time.
UTC
This method is the reverse manipulation of gmtime.
This method is the same as timegm function of Linux.
timegm
my $epoch = Time::Local->timegm($time_info_utc);
To install SPVM::Time::Local, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SPVM::Time::Local
CPAN shell
perl -MCPAN -e shell install SPVM::Time::Local
For more information on module installation, please visit the detailed CPAN module installation guide.