SPUG: File dates

David Poncelow panache at wolfenet.com
Thu Dec 30 12:08:02 CST 1999


Quite a simple solution, actually. The builtin function
localtime($date) will return an array containing all of the 
requisite information for the date (month, day of month, etc.)
If used in a scalar context (i.e. scalar(localtime($time)) ) it 
will return a nicely formatted date string, which it sounds
like is what you want.

On Thu, 30 Dec 1999, Daniel V. Ebert 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?
> 
> Thanks in advance,
> 
> ---
> Dan Ebert
> Seanet Internet Services
> 
> 
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>     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
> 
> 


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    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