You can convert both of them to GregorianCalendar and compare them ( Calendar is Comparable ). The semantics compareTo () method for the Calendar is explicitly defined and should work regardless of the time zone:
Compares the time values (millisecond offset from the Epoch) represented by two calendar objects.
So try the following:
XMLGregorianCalendar date1 = ... XMLGregorianCalendar date2 = ... int result = date1.toGregorianCalendar().compareTo(date2.toGregorianCalendar());
If result positive, then date1 "later" than date2
The compare() method on XMLGregorianCalendar itself does something rather peculiar and not very useful for me.
skaffman
source share