Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get the date of an input file 1

Status
Not open for further replies.

fabien

Technical User
Sep 25, 2001
299
AU
Hi!

$data_file="xxx/asidata.cgi";

open(DAT, $data_file) || die("Could not open file!");
@raw_data=<DAT>;
close(DAT);

I would like to display the date when xxx/asidata.cgi was created, how can get this info?

Thanks,
 
(@filedata)=stat $data_file;
$change_time=$filedata[10];
$last_access=$filedata[9];

you can also use -C as a file test operator to return the nyumber of days since the inode was changed. What that is I'm not sure

HTH
--Paul
 
Thanks but I get 1078912114 as a result of $change_time what format is this?

 
1078912114 is the number of seconds since the epoch Jan 1 1970

Code:
$var=1078912114 ;
 print scalar localtime($var);

HTH
--Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top