title: Javascript new Date() - Get seconds until end of the day
body: <p>Working on a javascript-canvas based clock (classic analog clock view), also displaying the current date below the clock.</p>
  
  <p>I already have this code to get the current time in javascript:</p>
  
  <pre><code>   // get current time
      var date = new Date();
      var hours = date.getHours();
      var minutes = date.getMinutes();
      var seconds = date.getSeconds();
      hours = hours &gt; 12 ? hours - 12 : hours;
      var hour = hours + minutes / 60;
      var minute = minutes + seconds / 60;
  </code></pre>
  
  <p>Works great, except that I don't know how to get the number in seconds until the end of the day, so I could run an ajax request at 00:00h to update the current date.</p>
  
  <p>The question is, how to get easily the number in seconds until end of the day in javascript?</p>
  
  <p>I plan to start a setTimeout()-function after the clock loaded with the number of seconds left, to update the date when needed.</p>