title: display time am/pm inside a div with javascript
body: <p>Hi Everyone I am sorry if this question has been answered before but I haven't been able to find a solution. I am completely new to js so please be nice :) </p>
  
  <p>I wanted to ask how can I have the time display inside a div? I can't get this function to display on my page. When I launch the page in the browser, it is just blank. </p>
  
  <p>Thank you, I hope my question makes sense. </p>
  
  <pre><code>document.getElementById("para1").innerHTML = formatAMPM(date);
  
  function formatAMPM(date) {
    var elem = document.getElementById("para1");
    var hours = date.getHours();
    var minutes = date.getMinutes();
    var ampm = hours &gt;= 12 ? 'pm' : 'am';
    hours = hours % 12;
    hours = hours ? hours : 12; // the hour '0' should be '12'
    minutes = minutes &lt; 10 ? '0'+minutes : minutes;
    var strTime = hours + ':' + minutes + ' ' + ampm;
    return strTime;
   }
  </code></pre>