title: Setting value of datetime-local from Date
body: <p>I would like to set the value of a datetime-local input with the current date and time. Right now I have an ugly solution that involves slicing the first 17 characters. In addition it sets the time in GMT instead of the local time. My code is as follows:</p>
  
  <pre><code>&lt;input type="datetime-local" name="name" id="1234"&gt;
  
  &lt;script type="text/javascript"&gt;
    var d = new Date();
    var elem = document.getElementById("1234"); 
    elem.value = d.toISOString().slice(0,16);
  &lt;/script&gt;
  </code></pre>
  
  <p>I have two problems with this code:</p>
  
  <ol>
  <li>Is there a way to convert from a <code>Date</code> to a legal value without manually slicing the string?</li>
  <li>I would like the string to be displayed in the datetime-local as <code>DD/MM/YYYY, hh:mm</code> (e.g. <code>05/11/2015, 14:10</code> it is <code>13:10</code> in GMT but I am in GMT+1 so I want to display <code>14:10</code>). What is currently displayed is <code>05/11/2015, 01:10 PM</code>. I would like to remove the PM and display in local time.</li>
  </ol>
  
  <p>This might be an <a href="https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem">XY problem</a>, so if I am doing it completely wrong and there is a better way to display datetime pickers in html, I would be happy to hear.</p>