Hi Brian,

Brian C. Huffman wrote:

> All,
> 
> Is there any way to use the ISO8601DateConverter without milliseconds?
> Right now, whenever I call xstream.toXML(object), I'm getting
> milliseconds in the output.
> 
> This is how I'm specifying the converter:
>      static {
>          xstream.registerConverter(new ISO8601DateConverter());
>      }

XStream's converter will always convert into a String with maximal 
information, but you can easily overwrite the toString method using a 
different formatter of Joda-Time:

  xstream.registerConverter(new ISO8601DateConverter() {
    String toString(Object o) {
      return new DateTime(o).toString(ISODateTimeFormat.dateTimeNoMillis());
    }
  });

Cheers,
Jörg


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to