View Full Version : Page Last Updated....
Jasonb61
11-02-2002, 03:06 PM
I needa way to retrieve the date and/or time for the last time a file was changed or midified.... is this possible? I need this script really so I can display some text at the bottom of the page that says "Page last updated on Saturday - November 2, 2002"
Please Help me!
Thanks!
filemtime($file_reference) should return a timestamp of the last modified.
Notes: You can do date() on the returned timestamp for better display. The results of calling filemtime are cached by the server (because it is a resource hungry function) so you'd need to clear the cache first.
I would not suggest doing it for every page view and suggest instead that you incorporate the call into your administration backend and only fire it when the new file is uploaded.
mordred
11-02-2002, 03:15 PM
Alternatively, use getlastmod():
http://us.php.net/manual/en/function.getlastmod.php
Nightfire
11-02-2002, 03:15 PM
echo "Page last modified" .date( "F d Y h:i:s", getlastmod() );
Nightfire
11-02-2002, 03:16 PM
Heh, how's that for service? 3 replies in less than a minnie
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.