Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Python, Lua and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Java, C, C++, Ruby, MySQL and Linux / Tomcat systems
Refreshing a page with PHP

Posted by FloppyShoe (FloppyShoe), 2 March 2004
Hi everyone.  I am a relative newbiw to the world of PHP and programming in general.

I am writing a page that shows the date (and sometimes the time) on a page and my question is this :
Is there a way I can get the page to refresh itself, say every hour or so, so that if someone leaves the page open over-night, it will display the current date when they come back to the computer the following day rather than still displaying the date of the previous day.

I hope that makes sense and more importantly that someone will be able to help!!

Many thanks in advance,


Posted by Chris_Isaac (Chris Isaac), 2 March 2004

if you use the following at the top of the script it will force the browser to reload the page rather than use a cached copy:


Posted by admin (Graham Ellis), 2 March 2004
I've put up a demo page at   The source code of the page is:

<title>This is a clock page</title>
<<meta http-equiv="Refresh" content="60; URL=clockpage.php4">
<h1>This clock page refreshes every minute</h1>
It is now <?php print(date("H:i o\\n l, j F Y")) ?>
Graham Ellis, <?php print (date ("Y")); ?>

Our server is in West Coast USA, so the report is Pacific time; you can vary that and should do so to suit the timezone of most of your users.

Chris's header shouldn't be necessary on a PHP page if the server is properly set up (but it would do no harm).  On an HTML page that you change frequently, it could be a good addition.

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2018: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: • WEB: • SKYPE: wellho