How do I create an XMLGregorianCalendar without a timezone? No time offset (0) == UTC which outputs a 'Z' in the output. The meaning of my field is implicit local time, where locality is specified elsewhere on the xml record (such as address).
How do I create an XMLGregorianCalendar with undefined timezone (TimeZone indeterminate)?
Valid XML ISO-8601 Gregorian Calendar formats include:
I looked at the documentation of XMLGregorianCalendar
. In the table at the top, the bottom row, it says that the timezone is
Number of minutes or
DatatypeConstants.FIELD_UNDEFINED
.
So let’s try the latter option:
System.out.println(xcal);
xcal.setTimezone(DatatypeConstants.FIELD_UNDEFINED);
System.out.println(xcal);
In one test run this printed:
2017-11-30T07:54:05.647+01:00
2017-11-30T07:54:05.647
After I set the time zone to undefined, it no longer prints the offset. So I believe I have obtained what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With