Generate and Format Last Updated in PHP

As a reader of many on line product reviews, I am always interested in the time this review is relevant for. As time pass things change and review get stale.

If you have this need as a webmaster and your review is file based (as appose to DB) you can use the filemtime function to automatically generate the last updated:

$LAST_UPDATED = date ("F d Y", filemtime('review.php'));

Where review.php is the file that holds the product review for example.

After doing that just echo $LAST_UPDATED at the top of the page and give your users a better and more reliable experience.

Share the love...Tweet about this on TwitterShare on LinkedInShare on Google+Share on Facebook

Amir Shevat

Amir Shevat is the global Startup Outreach lead in Google Developer Relations ( Previously, Amir Led Google Campus Tel Aviv and was the co founder of several startups.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *