Programming Wiki: Display When a Page Has Last Been Modified

Programming Wiki : PHPLastModifiedTimeStamp

WikiHomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Most recent edit on 2006-04-16 20:21:31 by ScottRippee

Additions:

PHP



Deletions:

PHP





Edited on 2005-10-11 08:41:08 by 12.44.178.253

Additions:

PHP

Display When a Page Has Last Been Modified



Deletions:

Display When a Page Has Last Been Modified





Oldest known version of this page was edited on 2005-09-30 21:16:32 by ScottRippee []
Page view:

Display When a Page Has Last Been Modified



The method I use to do this is really simple:

<?php
  putenv("TZ=America/Los_Angeles");
  echo date( "F d Y.", getlastmod() );
?>


The time zone just needs to be modified to match your own. This works great for me, but maybe not for others always? -> rwruck on www.php.net says:
"DO NOT use this function unless you are absolutely sure both your Apache and PHP have been compiled with the same value for -DFILE_OFFSET_BITS.

If not, this function will return the access time (or maybe even garbage) instead of the modification time due do Apache and PHP using different versions of the stat structure.

This is true regardless of Apache and PHP version.

To be on the safe side, always use the workaround already posted below:
filemtime($_SERVER['SCRIPT_FILENAME'])"

The info and techniques are bellow this at: http://us2.php.net/getlastmod
Powered by Wikka Wakka Wiki 1.1.6.0
Page was generated in 0.0205 seconds