title: JavaScript : How do i convert UTC Date Time to EST Hours using pure Javascript?
body: <p>i will get input time format as <strong>"2016-04-10 9:00:00.0"</strong> in the non-UTC compliance format. I need to append the "T" in the time to make it compliance with the UTC. I will also get the timezone as eg <strong>"-5.00"</strong> in the input. With this details i need to convert my input time to <strong>4 PM</strong> (EST time which was passed as TimeZone).</p>
  
  <p><strong>I can't use any third party library.</strong> </p>
  
  <p>HTML</p>
  
  <pre><code>&lt;h1&gt;
  TimeZone
  &lt;/h1&gt;
  &lt;h2 id="hourValue"&gt;
  
  &lt;/h2&gt;
  &lt;table&gt;
  &lt;tr&gt;
    &lt;td&gt;Date Time&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" id="txtDate" value="2016-04-10  09:00:00.0" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;TimeZone&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;&lt;input type="text" id="txtOffset" value="-5.00" /&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;&lt;input type="submit" id="btnSubmit" value="Convert" onClick="myTime()" /&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  
  JavaScript
  function myTime()
  {
  
  var d1= document.getElementById("txtDate").value;
  var zOffset = document.getElementById("txtOffset").value;
  console.log("Date1",d1);
  
  var d2 = new Date(d1.replace(/ /g,'T'));
  
  var d3= d2.getTime()+(d2.getTimezoneOffset()*60000);
  
  console.log("Date2",d2);
  console.log("Date3",d3);
  var d4 = new Date(d3 + (3600000 * zOffset));
  
  console.log("Date3",d3);
  console.log("Date 4",d4);
  
  var d5 = d4.toLocaleString();
  console.log("Date 5",d5);
  
  d6 =d5.match(/(\d+)(?=:\d+:\d+)|([A-Z]+)(?=$)/g).join(" ");
  
  console.log("Date6",d6)
  
  document.getElementById("hourValue").innerHTML = d6.value;
  }
  </code></pre>
  
  <p>I have given jsfiddle link below in the comments area, the fiddle works fine in FF and not in IE. That's my problem.</p>