removing timezone from webservice dates (XMLGregorianCalendar) for date of birth etc.

If you have webservice that recieves a XMLGregorianCalendar as a parameter, if you try to obtain date from it, you might see a difference of 1 day due to timezone differences. (i.e., xmlDate.toGregorianCalendar().getTime()) . The solution is to eliminate the timeZone from xmldate using the following:

xmlDt.setTimezone( DatatypeConstants.FIELD_UNDEFINED )

 

More details on this here:

http://knowhow.amazers.net/space/dev/java+tips/Hacks+around+XMLGregorianCalendar

Advertisements