echo "<p style=text-align:center'>$filename was last modified: ".date ("F d Y G:i P ", filemtime($filename))." GMT";
Add custom text to the end of .date
-
22-09-2022 - |
Question
I have a small section of code in my site showing when the index.php was last modified, it looks like this:
<?php
$filename = 'index.php';
if (file_exists($filename)) {
echo "<p style=text-align:center'>$filename was last modified: " .date ("F d Y G:i P ", filemtime($filename));
}
php?>
It currently displays as, index.php was last modified: December 30 2013 12:36 +01:00
But where the +01:00 is at the end, I would like to add the text 'GMT' so user can know it's +1 GMT.
Struggling to work out how to get it in there without breaking the code.
Solution
OTHER TIPS
try this:
echo "<p style=text-align:center'>$filename was last modified: " .date ("F d Y G:i P ", filemtime($filename)." GMT");
echo "<p style=text-align:center'>$filename was last modified: " .date ("F d Y G:i P e ", filemtime($filename));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow