Live clock javascript starts from my custom time

Posted by newworroo on Stack Overflow See other posts from Stack Overflow or by newworroo
Published on 2013-06-27T04:17:27Z Indexed on 2013/06/27 4:21 UTC
Read the original article Hit count: 156

Filed under:
|
|
|

I was trying to create a live/dynamic clock is based on my custom time instead of system time.

There are many scripts, but I couldn't find the clock starts from my custom time.

Here is an example that I'm trying to modify. The problem is the seconds doesn't change, and it looks like I need to use ajax. Is there any way to do it without ajax? If not, help me to do it using ajax!!! The reason I don't like ajax method is that another page should be called and refreshed, so it will eat server ram.

ex) http://www.javascriptkit.com/script/cut2.shtml

Before:

<script> 
function show(){ 
var Digital=new Date() 
var hours=Digital.getHours() 
var minutes=Digital.getMinutes() 
var seconds=Digital.getSeconds() 
... 
... 

After:

<script> 
function show(){ 
var Digital=new Date() 
var hours=<?php echo $hr; ?>; 
var minutes=<?php echo $min; ?>; 
var seconds=<?php echo $sec; ?>; 
... 
... 

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about AJAX