Guest User

Clock function

a guest
May 10th, 2012
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. window.onload = function(){
  2. var t = new Date();
  3. t.setTime(1332403882588);//your target time in UTC
  4. var clock = document.getElementById('clock');
  5. var inter = setInterval(writeTime,100);
  6.  
  7. function writeTime(){
  8. var out = new Date(t-new Date());
  9. clock.innerHTML = "Hours: "+out.getHours()+"<br>Minutes: "+out.getMinutes()+"<br>Seconds: "+out.getSeconds();
  10. }
  11.  
  12. }
Advertisement
Add Comment
Please, Sign In to add comment