SPUG: File dates

jimfl jimfl at colltech.com
Thu Dec 30 11:24:51 CST 1999


--On Thursday, December 30, 1999 8:26 AM -0800 "Daniel V. Ebert"
<debert at dusya.osd.com> wrote:

     > 
     > I have used the stats FILEHANDLE command to extract the "last
     > modified" time   of a file.
     > 
     > ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime,
     > $mtime,   $ctime, $blksize, $blocks) = stat FILEHANDLE;
     > 
     > This returns the time in a numrical format: 946568470
     > I'm guessing that this is the number of seconds since the epoch ...
     > is there   an easy way to translate that into a calendar date?  Or
     > is there a different   command that would return the modify time in
     > a different format?

You can get a string representation of the time with

  scalar localtime($mtime)

or you can get the individual elements 

  ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
                                                localtime($mtime);

--
Jim Flanagan          Collective Technologies
jimfl at colltech.com   http://www.colltech.com

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    POST TO: spug-list at pm.org        PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
        Email to majordomo at pm.org: ACTION spug-list your_address





More information about the spug-list mailing list