How may I get the saved date from the body (problem.php) file displayed in the footer.php portion of the created HTML file?
<?php
// problem.php
include_once 'top.php';
// Top.php provides <!DOCTYPE html> <HTML LANG="en"> <head> <title></title> </head> <body>
?>
<h2>Show the date this was saved in the footer</h2>
<p> Using XAMPP 8.1.6 HTTP/1.1" 200 and PHP 5.2.0 I try to learn.</p>
<p> My search have shown that document.write is bad. The only thing I have been able to make work is the script below. This will correctly show YESTERDAY's date here. The same script in the footer shows today's date.</p>
<p> How may I get this into a variable and use that in the FOOTER?</p>
<script language="javascript">
months = ['January', 'Febraury', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
var theDate = new Date(document.lastModified);
theDate.setTime((theDate.getTime()+(5000*60*60)) )
with (theDate) {
document.write("<i>Last updated "+getDate()+' '+months[getMonth()]+' '+(getYear()+1900)+"</i>")
}
</script>
<?php
include_once 'footer.php';
// Footer.php provides </body> </html>
?>
Edit: PHP dynamically creates the page so the date I see is the date the page was created (today). I wish to display the date the main body of the page (problem.php) was last changed or uploaded.
Edit 2: imvain2 provided the perfect answer with <?php echo date ("F d Y", filemtime(basename($_SERVER['SCRIPT_FILENAME']))); ?>
in footer.php. That worked when I changed my machine's date.