Hi
I'm using the following code to return information about a given file in Perl.
The information I'm trying to extract is the file size and the file modified date. The documentation tells me that:
9 mtime last modify time in seconds since the epoch
(The epoch was at 00:00 January 1, 1970 GMT.)
Therefore a check on a random file gives $mtime the value of 981541679 which I presume is 981541679 seconds since epoch.
How can I convert Jan 01 1970 + 981541679 into a date string? I would like this to be outputted in the mysql format 2001-10-01.
Thanks
- wil
I'm using the following code to return information about a given file in Perl.
Code:
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($_);The information I'm trying to extract is the file size and the file modified date. The documentation tells me that:
Code:
7 size total size of file, in bytes 9 mtime last modify time in seconds since the epoch
(The epoch was at 00:00 January 1, 1970 GMT.)
Therefore a check on a random file gives $mtime the value of 981541679 which I presume is 981541679 seconds since epoch.
How can I convert Jan 01 1970 + 981541679 into a date string? I would like this to be outputted in the mysql format 2001-10-01.
Thanks
- wil