Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jun 7th, 2012  |  syntax: None  |  size: 0.68 KB  |  views: 30  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. var values  = $(".updatetime").html().split(":");
  2. // var values = container.nodeValue.split(":");
  3.  
  4. // Because there is only a datetime specified, I assume is the current date
  5. var now = new Date();
  6. var time = new Date(now.getFullYear(), now.getMonth(), now.getDate(),
  7.                     values[0], values[1], values[2]).getTime();
  8.  
  9. setInterval(function() {
  10.     time += 1000;
  11.     var date = new Date(time);
  12.     var values = [date.getHours(), date.getMinutes(), date.getSeconds()];
  13.  
  14.     for (var i = 0; i < 3; i++)
  15.         if (values[i] < 10)
  16.             values[i] = "0" + values[i];
  17.  
  18.     //container.nodeValue = values.join(":");
  19.    $(".updatetime").html(values.join(":"));
  20. }, 1000);
clone this paste RAW Paste Data