Learn how to display the date and time when a page was last updated.
Letting visitors know the last time a page was updated is really easy to do in PHP.
First of all, place the following anywhere in your .php page where you would like it to appear.
<?What does all this mean?
$last_modified = filemtime("page.php");- this tells the browser what page you want to monitor or show when changes were last made to it. (Replace "page.php" to the page you add the code to.)
//print it all out print("Page Last Edited");- tells the browser what to place in front of the date. (You may change "Page Last Edited" to whatever you'd like.)
print(date("m/j/y h:i", $last_modified));- prints or displays the date for which the page was last modified.
That's it, your done!
Here is it in action:
This page was last updated on 05/12/11 11:37