title: Displaying Hours and Minutes as Words in JS
body: <p><strong>BACKGROUND</strong>: I'm using <code>getHours()</code> and <code>getMinutes()</code> to display the time on a page. </p>
  
  <p><strong>PROBLEM</strong>: I'm trying to figure out how to convert the numerical time (i.e., "21:00") to a written-out hour and minutes format (i.e. "nine 0'clock").</p>
  
  <p>My JS:</p>
  
  <pre><code>function startTime()
  {
  var today=new Date();
  var h=today.getHours();
  var m=today.getMinutes();
  // add a zero in front of numbers&lt;10
    m=checkTime(m);
    document.getElementById('time').innerHTML="The time is "+h+" o'clock and "+m+" past";
  t=setTimeout(function(){startTime()},500);
  }
  
    function checkTime(i)
    {
    if (i&lt;10)
      {
      i="0" + i;
      }
    return i;
    } 
  </code></pre>
  
  <p>Here's a <a href="http://jsfiddle.net/ndxcR/" rel="nofollow">fiddle</a></p>