How to format a date String into desirable Date format
<p>I was trying to format a string into date.</p>

<p>For this I have written a code:-</p>

<pre><code>Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
System.out.println(sdf.format( cal.getTime() ));
</code></pre>

<p>This is fine..
But now I want to convert a string into a date formatted like above..
For example </p>

<pre><code>String dt="2010-10-22";
</code></pre>

<p>And the output should be like this:-
    2010-10-22T00:00:00</p>

<p>How do I do this?</p>
