Jump to content

Page "Last modified time" in PHP

- - - - -

  • Please log in to reply
No replies to this topic

#1
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
What this is about: An automatic method of updating the date you had last modified a web page.

What I need to know:
Basic understanding of PHP's date() and time() functions

The code / Result:
Last updated: <?php echo date('F jS, Y', getlastmod()); ?>.
Last updated: January 19th, 2011.

Components:

F jS, Y: The date format fed to date()
getlastmod(): get current page's last modified time

This function shall be equivalent to filemtime(__FILE__)

Edited by Alexander, 23 April 2011 - 02:50 AM.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users