Home > Code Snippets > Date file last modified
Date file last modified
Description
Outputs the date and time that a file was last modified. Can be formatted however you wish.
The code
<?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);
?>
Get the code
Download the file to your computer: Click here to get the file
