Skip to content

Instantly share code, notes, and snippets.

@AndrewRussellHayes
Last active December 28, 2015 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrewRussellHayes/7547905 to your computer and use it in GitHub Desktop.
Save AndrewRussellHayes/7547905 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use Time::Local;
my $sec = 0;
my $min = 0;
my $hours = 0;
my $day = 28; #(days are 1-31)
my $month = 5; #(months are 0-11)
my $year = 2013;
my $logName;
my $loopLogDirectory;
my $time = timelocal($sec,$min,$hours,$day,$month,$year);
print $time;
print scalar localtime($time);
#epoch time to printed time
$time = (stat("$loopLogDirectory/$logName"))[9];
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime($time);
my $nice_timestamp = sprintf ( "%02d/%02d/%04d %02d:%02d:%02d",$mon+1,$mday,$year+1900,$hour,$min,$sec);
print "\t\t$nice_timestamp\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment