René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Converting unix time and readable time with Perl

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 "$unixtime\n";

my $readable_time = localtime($unixtime);

print "$readable_time\n";