Search code examples
javadatedatetimegregorian-calendar

Grab exact date without timezone interfering with XMLGregorianCalendar in Java


I have a XMLGregorianCalendar that I would like to convert to a Java Date object, but when I try to covert this:

2013-11-19T00:00:00-00:00

I always get a date with the value a day behind.

Mon Nov 18 17:00:00 MST 2013

I just want a date object containing 11/19/2013.


Solution

  • I just did this,

    Date startDate = new Date(request.getStartTime().getYear(), request.getStartTime().getMonth(), request.getStartTime().getDay(), 0, 0, 0);