title: unable to get Am Pm from date object using javascript
body: <p>I am having date Object in javascript , by this date object I am trying to get <code>AM</code> , or <code>PM</code>. Here is date Object <code>Mon May 01 2017 12:43:30 GMT+0530 (India Standard Time)</code> </p>
  
  <p>According to time it should return <code>pm</code> as it is 12:43 noon as per Indian Standard Time.But returning 'am'</p>
  
  <p>And here is my logic </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var x = new Date("Mon May 01 2017 12:43:30 GMT+0530"); // (India Standard Time)
  var hours = x.getHours();
  var hours = (hours + 24 - 2) % 24;
  var amPmStr = ' am';
  if (hours == 0) { //At 00 hours we need to show 12 am
    hours = 12;
  } else if (hours &gt; 12) {
    hours = hours % 12;
    amPmStr = ' pm';
  }
  console.log(amPmStr,x)</code></pre>
  </div>
  </div>
  </p>