so I am currently using
my $date = DateTime->now->mdy;
which gives me the format in "09-10-2013"
then i used
my $modTime = localtime((stat($some_file))[9]);
which gives me the date in format "Tue Sep 10 15:29:29 2013"
is there a way built in perl to format the $modTime to the format like $date? or do i have to do it manually?
thanks!
Create a DateTime object using the
from_epoch
constructor.Of course, that can be rewritten as a single line:
But for something this easy, I'd probably use Time::Piece (which is part of the Perl standard distribution) rather than DateTime.