Display the date/timestamp of a file
Moderator: General Moderators
-
paulpechey
- Forum Newbie
- Posts: 1
- Joined: Sat Nov 13, 2004 3:23 pm
Display the date/timestamp of a file
I want to dynamically display the date that my web pages were updated, and figure I should be able to retrieve the date/timestamp of the file as a PHP variable, and then display it. However, I can't seem to find out how to do this anywhere. Can anyone help?
-
Hi,
If it should be the real date of a real file modified this is the way to get the filetime:*source: http://www.php.net/manual/en/function.filemtime.php
djot
-
Hi,
If it should be the real date of a real file modified this is the way to get the filetime:
Code: Select all
<?php
// outputs e.g. somefile.txt was last modified: December 29 2002 22:16:23.
$filename = 'somefile.txt';
if (file_exists($filename)) {
echo "$filename was last modified: " . date ("F d Y H:i:s.", filemtime($filename));
}
?>djot
-