Programming Wiki: Display When a Page Has Last Been Modified

Programming Wiki : PHPLastModifiedTimeStamp

WikiHomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

Display When a Page Has Last Been Modified

PHP


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

There are no comments on this page. [Add comment]

Powered by Wikka Wakka Wiki 1.1.6.0
Page was generated in 0.0211 seconds