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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: