title: How Do I Create A Countdown Time That Resets At A Specific Time
body: <p>Let me first say I do not have a deep understanding of javascript but I know how to work my way around enough to write small scripts for pages.  A client of mine needs me to do the following for a website:</p>
  
  <ol>
  <li>Find the user's local time on their computer.</li>
  <li>Take that local time and subtract it from 6pm.</li>
  <li>Display that time in a countdown or just a statement letting the user know how much time is left for same day shipping.</li>
  <li>After 6pm the time resets or disappears until the next business day.</li>
  </ol>
  
  <p>So far I've been able to create the logic for getting the time from the local computer.  I thought I'd be able to use datejs but it does not calculate hours in a day.</p>
  
  <p>Here is the current code I have:</p>
  
  <pre><code>var currentTime = new Date()
  var hours = currentTime.getHours()
  var minutes = currentTime.getMinutes()
  
  var suffix = "AM";
  if (hours &gt;= 12) 
  {
    suffix = "PM";
    hours = hours - 12;
   }
  
  var suffix = "AM";
  
  if (hours &gt;= 12) 
  {
    suffix = "PM"; 
    hours = hours - 12;
  }
  
  if (hours == 0) 
  {
    hours = 12;
  }
  
  if (minutes &lt; 10)
    minutes = "0" + minutes;
  
  document.write("&lt;b&gt;" + hours + ":" + minutes + " " + suffix + "&lt;/b&gt;");
  </code></pre>