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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

time and date of file

Status
Not open for further replies.

Porshe

Programmer
Jun 5, 2001
38
US
I need to get a legible date and time of a file. I need the atime (read) and mtime(modification) time of my file, t_results.html.
I tried this:
my ($readtime, $modtime) = (stat($t_results))[8,9];
#print "$readtime \n";
#print "$modtime \n";

But I get this:
991849314
991851908

Thanks in advance,
Porshe
 
those are the correct times, just in a format you don't understand - seconds from the epoch, also called a unix timestamp. to convert it to something you can use, use the perl function localtime() (and read the perldoc entry for it first). "If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
 
try:
Code:
my($sec,$min,$hour,$day,$mon,$year,$wkday,$jul,$isdst) = localtime($readtime);

Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top