title: Javascript write time in specific format
body: <p>I'm using Javascript along with Date.js and need to translate string representations of times.</p>
  
  <p>I'm starting with times in this format:</p>
  
  <pre>
  3:00am
  2:30pm 
  11:00am
  </pre>
  
  <p>...and need to put them in this format:</p>
  
  <pre>
  03:00:00
  14:00:00
  11:00:00
  </pre>
  
  <p>I was thinking of starting with Date.parse() and then printing out the hours, minutes, and seconds.  But was wondering if there is a more elegant way to do this such as something along the lines of <code>Date.format("HH:MM:SS")</code></p>
  
  <p>What is a good way to do this?</p>
  
  <p>Thanks!</p>
  
  <p><strong>Edit::::</strong></p>
  
  <p>It looks like you can use the format specifiers with Date.js: <a href="http://code.google.com/p/datejs/wiki/FormatSpecifiers" rel="nofollow">http://code.google.com/p/datejs/wiki/FormatSpecifiers</a></p>
  
  <pre><code>Date.parse("3:00am").toString("HH:mm:ss");
  </code></pre>