Created
November 7, 2011 22:32
-
-
Save puneetlakhina/1346424 to your computer and use it in GitHub Desktop.
Convert localtime to unix timestamp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
#Format of ip Month/Year/DateThour:minute:seconds | |
use Time::Local; | |
my ($date,$time) = split 'T' , $ARGV[$1]; | |
#print $date."\n".$time."\n"; | |
my ($month, $day, $year) = split '/', $date; | |
$month = $month - 1; #this is because timelocal wants the month to be zero indexed | |
#print $month."\n"; | |
my ($hr, $min, $secs) = split ':', $time; | |
my $utctime = timelocal($secs,$min,$hr,$day,$month,$year); | |
print $utctime."\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment