Many a times you may need to convert the human readable time into the Unix time. When all the information is passed to “mktime” it returns the unixtime. And to reverse it simply use “localtime”. Here is the example.
use POSIX; use strict; use warnings; my $sec = 6; my $min = 7; my $hour = 8; my $day = 9; my $mon = 10 - 1; my $year = 2004 - 1900; my $wday = 0; my $yday = 0; my $unixtime = mktime ($sec, $min, $hour, $day, $mon, $year, $wday, $yday); print "$unixtimen"; my $readable_time = localtime($unixtime); print "$readable_timen";
Found at http://www.adp-gmbh.ch/perl/posix/convert_time.html