Java Compare DateTime objects in Joda

isAfter and isBefore methods compare dates by millis (ignoring time zone).

System.out.println(londonDT.getMillis() == estDT.getMillis());

will print true.

londonDT.isBefore(estDT) 
londonDT.isAfter(estDT)

are equal to

londonDT.getMillis() < estDT.getMillis()  
londonDT.getMillis() > estDT.getMillis()

References :
http://stackoverflow.com/questions/17172782/comparing-two-joda-time-datetime-objects

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.