java : java.text.ParseException: Unparseable date
<p>I am reciving a input in this format 2012-01-13T00:00:00.000-05:00 and which i need to convert this into  yyyyMMdd Format .
I have also set the SimpleDateFormat.setLenient(false);</p>

<p>This is my coding for parsing the Date </p>

<pre><code>public static String getparsedDate(String date) throws Exception {
        DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US);
        sdf.setLenient(false);

        String s1 = date;
        String s2 = null;
        Date d;
        try {
            d = sdf.parse(s1);
            s2 = (new SimpleDateFormat("yyyyMMdd")).format(d);

        } catch (ParseException e) {

            e.printStackTrace();
        }

        return s2;

    }
</code></pre>

<p><strong>But i am getting a Exception at</strong> </p>

<p>java.text.ParseException: Unparseable date: "201201"</p>

<pre><code>at java.text.DateFormat.parse(Unknown Source)
</code></pre>

<p>Could anybody please let me  know , what might be the issue ?</p>
