XML conversion by using XStream : not able parse date of format 2016-02-04T18:01
<p>I am converting a XML using XStream.</p>

<p>My XML looks like below.</p>

<pre><code>&lt;reportUnit&gt;
    &lt;creationDate&gt;2016-02-04T18:01&lt;/creationDate&gt;
    &lt;description&gt;Days Late Report&lt;/description&gt;
    &lt;label&gt;Days Late Report&lt;/label&gt;
    &lt;permissionMask&gt;2&lt;/permissionMask&gt;
    &lt;updateDate&gt;2014-10-31T19:45&lt;/updateDate&gt;
&lt;/reportUnit&gt;
</code></pre>

<p>My Java code for converting the XML is like </p>

<pre><code>XStream xStream = new XStream();
xStream.alias("reportUnit", ReportUnit.class);
xStream.registerConverter(
            new com.thoughtworks.xstream.converters.basic.DateConverter("yyyy-MM-dd HH:mm", new String[] {"dd/MM/yyyy HH:mm"},new GregorianCalendar().getTimeZone()){
              public boolean canConvert(Class type) {
                    return type.equals(Date.class) || type.equals(Timestamp.class);
              }
              public String toString(Object obj) {
                  return new SimpleDateFormat("yyyy-MM-dd HH:mm").format((Date) obj);
              }
        });

xStream.fromXML(objectXml.replace("&lt;?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?&gt;", BLANK));
</code></pre>

<p>The above code works for the date format </p>

<pre><code>&lt;creationDate&gt;2016-02-04 18:01&lt;/creationDate&gt;
</code></pre>

<p>but not for the </p>

<pre><code>&lt;creationDate&gt;2016-02-04T18:01&lt;/creationDate&gt;
</code></pre>

<p>I am getting an exception as : Cannot parse date <strong>2016-02-04T18:01</strong></p>

<p>I tried using the ISO8601DateConverter from thoughtworks available at below package</p>

<p><strong><code>"com.thoughtworks.xstream.converters.extended.ISO8601DateConverter"</code></strong></p>

<p>But that did not resolve my issue ...</p>

<p>Did anyone had the same issue and know how to resolve the same.</p>