I'm looking for a javascript that refreshes the page when the server time hits zero (every hour).
Something like that should work:
$diff = mktime(date("H") + 1, 0, 0, date("m"), date("d"), date("Y")) - time();
echo('<meta http-equiv="refresh" content="' . $diff . '" />');
But keep in mind to separate your business from your view logic ;-)
(You can also omit the "date("m"), date("d"), date("Y")" which i added to help understanding the code)
If you want to use Javascript, just use a setTimeout with a one second interval which counts the Value from $diff down to 0;
If the page just needs to refresh after an hour, the server can set meta tag in the page header when the page is first served:
<meta http-equiv="refresh" content="3600">
where 3600 is an hour in seconds. If you want it on the hour, as opposed to after an hour, the server can set the number of seconds to be the number of seconds until the next hour (e.g if the server time is 10:30, it would set it to 1800.
There are two possible ways as I know.
Option 1 would be more accurate as you would get the current time related to time-zone as opposed to second option because there would be a delay as to when the server adds the meta and when does your js reads it.
But option 2 is more favorable if your server location can possibly change.