public class ZonedDateTimeAdapter extends XmlAdapter<String,ZonedDateTime>
ZonedDateTime
and an ISO 8601 profile know as W3C Datetime format.
The unmarshal proces will convert given datetime strings to UTC (Coordinated Universal Time).
If a datetime string has no timezone info, we assume that the datetime is in the timezone
that is returned by the static ZonedDateTimeUtil.getZoneId()
. This timezone will default to
ZoneId.systemDefault()
, and can be set with ZonedDateTimeUtil.setZoneId(ZoneId)
.
2016 -> 2015-12-31T14:00Z 2015-08 -> 2015-07-31T14:00Z 2014-08-09 -> 2014-08-08T14:00Z 2013-03-09T14 -> 2013-03-09T04:00Z 2012-03-09T14:30 -> 2012-03-09T04:30Z 2011-03-09T14:30:29 -> 2011-03-09T04:30:29Z 2010-01-09T14:30:29.1 -> 2010-01-09T04:30:29.100Z 2010-03-09T14:30:29.123 -> 2010-03-09T04:30:29.123Z 2010-04-09T14:30:29.1234 -> 2010-04-09T04:30:29.123400Z 2010-06-09T14:30:29.123456 -> 2010-06-09T04:30:29.123456Z 2009-03-09T14:30:29.123+01:00 -> 2009-03-09T13:30:29.123Z 2008-03-09T14:30:29.123-01:00 -> 2008-03-09T15:30:29.123Z 2007-03-09T14:30:29.123Z -> 2007-03-09T14:30:29.123Z 2006-03-09T14:30:29.123456789Z -> 2006-03-09T14:30:29.123456789Z 2005-03-09T14:30Z -> 2005-03-09T14:30Z
Constructor and Description |
---|
ZonedDateTimeAdapter() |
Modifier and Type | Method and Description |
---|---|
String |
marshal(ZonedDateTime value) |
ZonedDateTime |
unmarshal(String value) |
public ZonedDateTime unmarshal(String value) throws Exception
unmarshal
in class XmlAdapter<String,ZonedDateTime>
Exception
public String marshal(ZonedDateTime value) throws Exception
marshal
in class XmlAdapter<String,ZonedDateTime>
Exception
Copyright © 2017. All rights reserved.