Timezone Cheat Clock

This is a project I created many years ago, and haven't touched in about 10 to 13 years. It's mainly here for posterity, but if you still find it useful (and if it still works) then by all means feel free to make use of it. Any references to "6 times 9" are because that is the retired website where I was previously hosting things like this.

About

A clock that displays the current time for the host server by cheating - the start time is specified using PHP (or similar) and the script adds 1 to the seconds each second and adjusts minutes and hours accordingly. It should be accurate to within a second of the server's time (depending on page loading time).

The idea is that it will always display the time for a certain timezone regardless of where the person viewing the page is located.

Example

Please note these clock don't do Daylight Savings Time; they display the Standard Time for the respective cities...

London: Thu 1:35:17 pm GMT (Clock not running)

San Francisco: Thu 5:35:17 am PST (Clock not running)

New York: Thu 8:35:17 am EST (Clock not running)

Tokyo: Thu 10:35:17 pm JST (Clock not running)

Using

Clocks are defined in cheatclock.php itself, in the section at the top labelled "Setup Section".

The format for configuring a clock is:

"ID" => array("code" => "TIMEZONE", "offset" => HOURS),

ID is the ID that is to be used in the <span> (explained later), TIMEZONE is the code for the timezone (GMT, PST, EST, etc.), and HOURS is the difference in hours from UTC. The quotation marks are important.

For example, the setup section for the four clocks used in the example above is:

// SETUP SECTION
$clocks=array(
  "london" => array("code" => "GMT", "offset" => 0),
  "sanfran" => array("code" => "PST", "offset" => -8),
  "newyork" => array("code" => "EST", "offset" => -5),
  "tokyo" => array("code" => "JST", "offset" => 9),
);
// END OF SETUP SECTION

Once the setup section has been completed, add the following to the <head> section of the webpage(s):

<script src="cheatclock.php"></script>

Then add: <span id="ID"></span> where you want the clock to appear for each of the specified clocks (where ID is the ID specified in the setup section).

Download

To download Timezone Cheat Clock just right-click and choose "Save As" (or the equivalent for your device/web browser).

Last updated: (version "Echo")