Here's the topo, i have JAXB generated java classes from XSD files. For xsd:datetime
type, the transformation goes through the public static Calendar javax.xml.bind.DatatypeConverter.parseDateTime(String lexicalXSDDateTime)
method.
I do not have access to the string value of the date (the one in the xml file), all i have access to is the generated Calendar
object, and what i want to know, is whether in the original string value of the date, a timezone was defined or not.
For example, this string 2015-07-29T11:17:02.428+02:00
has a defined timezone, where this one 2015-07-29T11:17:02.428
have an undefined one, and all i want to know is which generated Calendar
object had originally a defined timezone.
I tried the Calendar.getTimeZone()
method, but it seems that the xsd to java transformation doesn't nullify the timezone.
As for example, the following code
System.out.println(DatatypeConverter.parseDateTime("2015-07-29T11:17:02.428+02:00").getTimeZone());
System.out.println(DatatypeConverter.parseDateTime("2015-07-29T11:17:02.428").getTimeZone());
Outputs this
sun.util.calendar.ZoneInfo[id="GMT+02:00",offset=7200000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
sun.util.calendar.ZoneInfo[id="Europe/Paris",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]]