String (dd-MM-yyyy HH:mm) to Date (yyyy-MM-dd HH:mm) | Java
<p>I have a string in "dd-MM-yyyy HH:mm" and need to convert it to a date object in the format
"yyyy-MM-dd HH:mm".</p>

<p>Below is the code I'm using to convert</p>

<pre><code>oldScheduledDate = "16-05-2011 02:00:00";
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date oldDate = (Date)formatter.parse(oldScheduledDate);
</code></pre>

<p>Now when I print oldDate, i get</p>

<p><code>Sat Nov 01 02:00:00 GMT 21</code>, which is completely wrong, what am I doing wrong here?</p>
