Page 1 of 1

How to read last modified date of a file using php

Posted: Fri Jul 15, 2011 6:31 pm
by Saman
Outputs the date and time that a file was last modified. Can be formatted however you wish.

Code: Select all

<?php 
 
// Change to the name of the file 
$last_modified = filemtime("thisfile.php"); 
 
// Display the results 
// eg. Last modified Monday, 27th October, 2003 @ 02:59pm 
print "Last modified " . date("l, dS F, Y @ h:ia", $last_modified); 
 
?>