Using PHP to Display a File Date

Thank you to everyone who has sent in suggestions on how to solve my problem of time stamping a jpeg or html file. I now have more suggestions than I could possibly test in a week. I will post solutions as I can find the time to do so.

So far, one suggestion that works is from Rick Hellewell:

// outputs e.g. somefile.txt was last modified: December 29 2002
$filename = 'somefile.txt';
if (file_exists($filename))
echo "$filename was last modified: " . date ("F d Y H:i:s.",

I believe it assumes that the ‘somefile.txt’ is in the current directory (the directory that the current PHP page is in). I got it from the PHP pages here:
And the extension of the web page needs to be PHP. …Rick…

You insert the the above code into a web page anywhere between the <body> </body>tags, make sure the name of the web page has the .php extension and, assuming your web server is setup to use PHP, Bob’s your Uncle, it works!

But for now, thank you to Peter Thomas, fellow Daynoters Rick Hellewell and John Domonik, and Frank Fitz for sending in suggestions/examples. I will get to each as soon as I can. If I missed anyone I apologize, it was purely unintentional.



Comments are closed.