Get Last Modified Date/Time
This little script gets the last modified date of the current file:echo getlastmod();
This code will output a bunch of numbers like so: 1609244332 Now that's not pretty to read so use the date function to format it into something more readable. As I'm not in the US, I prefer different formatting for my date so I added some timezone information to the script (to get the correct time). You don't need this and feel free to take it out or change it your timezone:
putenv("TZ=Europe/London"); echo date( "D M d, Y, r", getlastmod() );
Which will produce:
Tue, 29 Dec 2020 12:18:52 +0000
You can see this working at the bottom of every one of my pages (minus the time, I don't want everyone knowing the crazy hours I'm up updating this site). For more information on how to format the date/time string have a look at the PHP Manual