Convert JAXBElement<XMLGregorianCalendar> to OffsetDateTime
问题 I am trying to convert the JAXBElement-XMLGregorianCalendar to offsetDateTime. I am able to do that but i want to convert the date in a particular format. Code i am using to convert : calendarValue is 2016-03-25T00:00:00+05:30 but i need to covert the type to offsetDateTime so i am doing below conversion calendarValue.toGregorianCalendar().getTime().toInstant().atOffset(ZoneOffset.UTC) In response i am getting the value after converting as : 2016-03-24T18:30:00Z while i want the converted