I was trying to format a string into date.
For this I have written a code:-
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
System.out.println(sdf.format( cal.getTime() ));
This is fine.. But now I want to convert a string into a date formatted like above.. For example
String dt="2010-10-22";
And the output should be like this:- 2010-10-22T00:00:00
How do I do this?