punch_card_don has asked for the wisdom of the Perl Monks concerning the following question:
Maverick Monks,
Forget that fear of gravity,
Get a little savagery in your life.
This snippet:
produces this output:$file_w_path = "../../../images/".$filename; ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, +$ctime, $blksize, $blocks) = stat($file_w_path); print "<br>mtime = $mtime\n"; ($sec, $min, $hr, $day, $month, $year, $day_Of_Week, $julianDate, $dst +) = localtime($mtime); print "<br>$sec, $min, $hr, $day, $month, $year, $day_Of_Week, $julian +Date, $dst\n";
where 1182819156 is the correct epoch time for the file, but I can't make sense of the localtime output. Clearly I'm using localtime wrong...and yet,1182819156 Time::tm=ARRAY(0x84eb290), , , , , , , ,
http://perldoc.perl.org/functions/localtime.html
localtime
Converts a time as returned by the time function to a 9-element list with the time analyzed for the local time zone. Typically used as follows:
# 0 1 2 3 4 5 6 7 8
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
Thanks.
Forget that fear of gravity,
Get a little savagery in your life.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Strage result using localtime to convert epoch time
by Joost (Canon) on Jul 20, 2007 at 22:23 UTC | |
Re: Strage result using localtime to convert epoch time
by revdiablo (Prior) on Jul 20, 2007 at 21:29 UTC | |
Re: Strage result using localtime to convert epoch time
by punch_card_don (Curate) on Jul 20, 2007 at 23:58 UTC | |
by Joost (Canon) on Jul 21, 2007 at 00:37 UTC | |
by punch_card_don (Curate) on Jul 21, 2007 at 17:15 UTC |
Back to
Seekers of Perl Wisdom