Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <script>
- var today=new Date('<?php echo date('F j, Y h:i:s')?>');
- function startTime()
- {
- var today1 = new Date();
- today1.setDate(today.getSeconds()+1);
- var h=today1.getHours();
- var m=today1.getMinutes();
- var s=today1.getSeconds();
- // add a zero in front of numbers<10
- m=checkTime(m);
- s=checkTime(s);
- document.getElementById('txt').innerHTML=h+":"+m+":"+s;
- t=setTimeout(function(){startTime()},1000);
- }
- function checkTime(i)
- {
- i=(i<10)?"0" + i:i;
- return i;
- }
- </script>
- </head>
- <body onload="startTime()">
- <div id="txt"></div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement