convert string to date in java in format 2012-07-27
<p>i have the input string as 2012-07-27 and i want the output as date but with the same format like 2012-07-27</p>

<p>my code is </p>

<p>DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");</p>

<pre><code>    try {
        Date today = df.parse("20-12-2005");
        System.out.println("Today = " + df.format(today));

                 } catch (ParseException e) {
        e.printStackTrace();
    }
</code></pre>

<p>my output is</p>

<pre><code>Fri Jul 27 00:00:00 IST 2012
</code></pre>

<p>but i want to return the date object like like 2012-07-26 23:59:59 instead of a string  any help please</p>

<p>any help is very thank full</p>
