Java : Cannot format given Object as a Date
<p>I have Date in this format  (2012-11-17T00:00:00.000-05:00) , i need to convert the date into this format mm/yyyy .</p>

<p>I tried this way m, but i am getting this Exception .</p>

<pre><code>Exception in thread "main" java.lang.IllegalArgumentException: Cannot format given Object as a Date
    at java.text.DateFormat.format(Unknown Source)
    at java.text.Format.format(Unknown Source)
    at DateParser.main(DateParser.java:14)
</code></pre>

<p>Please see , this is my code </p>

<pre><code>import java.text.SimpleDateFormat;
import java.util.Date;

public class DateParser {

    public static void main(String args[]) {

        String MonthYear = null;

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mm/yyyy");

        String dateformat = "2012-11-17T00:00:00.000-05:00";

        MonthYear = simpleDateFormat.format(dateformat);

        System.out.println(MonthYear);

    }

}
</code></pre>
