Convert date from m/d/yy to mm/dd/yyyy
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/8742830/conversion-of-date">Conversion of Date</a><br>
  <a href="http://stackoverflow.com/questions/10404824/how-to-convert-date-from-m-d-yy-to-mm-dd-yyyy">How to convert date from m/d/yy to mm/dd/yyyy?</a>  </p>
</blockquote>



<p>I get the date in a String as: 5/1/12.
I need to convert it to 05/01/2012.
Please suggest.</p>

<p>I used the following code:</p>

<pre><code>SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");

d_date = dateFormat.parse("5/1/12"); 

strDate = dateFormat.format(d_date);

Result:
05/01/0012
</code></pre>

<p>Expected Result:
05/01/2012</p>

<p>Thanks
Prasad</p>
