Wednesday, April 30, 2008

Epoch/Unix time to normal time

#!/usr/bin/perl

my $time = $ARGV[0];
my @months = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
my ($sec, $min, $hour, $day,$month,$year) = (localtime($time))[0,1,2,3,4,5,6];

print "Unix time ".$time." --> ".$months[$month]." ".$day.", ".($year+1900)." ".$hour.":".$min.":".$sec."\n";