Perl Notes/epoch.pl

From Federal Burro of Information
Revision as of 15:23, 10 January 2013 by David (talk | contribs) (Created page with "<pre> use Time::Local; my %month = ( 'Jan' => '0', 'Feb' => '1', 'Mar' => '2', 'Apr' => '3', 'May' => '4', 'Jun' => '5', 'Jul' => '6', 'Aug' => '7', 'Sep' => '8', 'Oct' => '...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
use Time::Local;
my %month = (   'Jan' => '0', 'Feb' => '1', 'Mar' => '2', 'Apr' => '3', 'May' => '4', 'Jun' => '5', 'Jul' => '6', 'Aug' => '7', 'Sep' => '8', 'Oct' => '9', 'Nov' => '10', 'Dec' => '11' );
my $year = "2013";
my $mon = 'Jan';
my $day = '10';
my $hour = '4';
my $min = '18';
my $sec = '';

$epoch = timelocal($sec,$min,$hour,$day,$month{$mon},$year);

print "Epoch $epoch Time ".localtime($epoch)."\n";