title: JavaScript: Difference between toString() and toLocaleString() methods of Date
body: <p>I am unable to understand the difference between the <code>toString()</code> and <code>toLocaleString()</code> methods of a <code>Date</code> object in JavaScript. One thing I know is that <code>toString()</code> will automatically be called whenever the <code>Date</code> objects needs to be converted to string.</p>
  
  <p>The following code returns identical results always:</p>
  
  <pre><code>​var d = new Date();
  document.write( d + "&lt;br /&gt;" );
  document.write( d.toString() + "&lt;br /&gt;" );
  document.write( d.toLocaleString() );
  </code></pre>
  
  <p>​
  And the output is:</p>
  
  <pre><code>Tue Aug 14 2012 08:08:54 GMT+0500 (PKT)
  Tue Aug 14 2012 08:08:54 GMT+0500 (PKT)
  Tue Aug 14 2012 08:08:54 GMT+0500 (PKT)
  </code></pre>