Mega Code Archive

 
Categories / Php / File Directory
 

Stat() function returns Unix timestamps for the date and time data

<?php  $file = 'data.txt';  $data = stat($file);  $accessed = $data['atime'];  $modified = $data['mtime'];  $created = $data['ctime'];  echo "file <b>$file</b> was...<br />\n"  . 'last accessed ' . date('l d F Y, \a\t H:i:s', $accessed) . ',<br />\n'  . 'last modified ' . date('l d F Y, \a\t H:i:s', $modified) . ',<br />\n'  . 'and created ' . date('l d F Y, \a\t H:i:s', $created)  . '.';  ?>