File accessed, modified, created time : stat « File Directory « PHP






File accessed, modified, created time

 
<?php
  
  $file = 'testfile.html';
  $data = stat($file);
  
  $accessed = $data['atime'];
  $modified = $data['mtime'];
  $created = $data['ctime'];
  
  echo "The 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)
        . '.';
?>
  
  








Related examples in the same category

1.Converting file permission values
2.stat() function returns Unix timestamps for the date and time data
3.stat() function returns a comprehensive indexed array of file information