Special clock...?

Posted on 2003-11-09
Last Modified: 2008-03-06
Can I make a clock that starts off the same as the server time, but then runs twice as fast as a clock in reality? Also it would have to print the data onto a page.
Question by:JavaHead_Jonnie
LVL 19

Accepted Solution

Michael701 earned 150 total points
ID: 9712106
sure why not,

<script type="text/javascript">
var timer = null

echo "var hours = ".$now['hours']."\n";
echo "var minutes = ".$now['minutes']."\n";
echo "var seconds = ".$now['seconds']."\n";
function start_clock()
timer = setTimeout("update_clock()",1000)

function stop_clock()

function update_clock()
  if (seconds < 59)
    if (minutes < 59)
      if (hours < 12)
document.forms["clock"].display.value = hours + ":" + ((minutes < 10) ? "0" : "") + minutes + ":" + ((seconds < 10) ? "0" : "") + seconds
timer = setTimeout("update_clock()",1000) //********* change this to 500 to make the clock run twice as fast
<body onload="start_clock()" onunload="stop_clock()">
<form name="clock">
<input type="text" name="display" size="10">

Author Comment

ID: 9715825
Thanks, it works a treat! It's just what I wanted.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now