title: Formatting the date time with Javascript
body: <p>I have a date/time string like <code>2012-01-13 04:37:20</code> but I want to convert it to <code>dd-mm-yyyy hh:mm</code>, how can i do this?</p>
  
  <p>I am using the following code but it throws an exception.</p>
  
  <pre><code>var now = "2012-01-13 04:37:20";
  var dd = now.toLocaleDateString() + " " + now.toLocaleTimeString();
  alert(dd);
  </code></pre>