Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 6th, 2004, 07:09 PM
Authorized User
 
Join Date: Aug 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default document.LastModified not working correctly in php

I am trying to set up a page (or two) within php with a simple line that indicates when the page had been last modified.

What I'm encountering is that the 'modified' date is always changing to the present date. If it says it's Monday when it was modified last, had not been changed since, tomorrow it'll say Tuesday and so on (always the present date).

Is there not a way to keep this as Monday? Here is the code:
<script type="text/javascript">
update = new Date(document.lastModified);
theMonth = update.getMonth() + 1;
theDate = update.getDate();
theYear = update.getFullYear();
document.writeln("<I>Last updated:" + theMonth + "/" + theDate + "/" + theYear + "</I>");
</script>

This is working in files with a "html" extension, but not the "php" extension such as LastChanged.html versus LastChanged.php.

Is there a way to show the lastModified date in php and have the same effect as it would in an html file? Or am I forced to set the file as an html file?
 
Old December 7th, 2004, 10:04 AM
Authorized User
 
Join Date: Aug 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Wow, me bad...
One google search later (after the post), and I found the solution:
echo "<b>Last modified:</b> " . date( "F d, Y.", getlastmod() );





Similar Threads
Thread Thread Starter Forum Replies Last Post
Contains function call not working correctly cnatale XSLT 7 May 8th, 2008 07:53 AM
Hello User, not working correctly? Neotriple BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 October 5th, 2006 11:39 AM
Proxxy Connections working, but not correctly??? ramangill VB.NET 0 August 10th, 2005 06:54 AM
Proxxy Connections working, but not correctly??? ramangill Oracle 0 August 10th, 2005 06:53 AM
No error but not working correctly! Adam H-W Javascript 7 November 10th, 2003 09:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.