Comparing two dates using Joda time

后端 未结 9 1083
春和景丽
春和景丽 2020-12-14 14:47

I want to compare two dates, however I\'m running into trouble. 1 date is created from a java.util.date object and the other is manually crafted. The following

9条回答
  •  时光说笑
    2020-12-14 15:47

    As they're DateTime objects, their time parts are also taken into consideration when you're comparing them. Try setting the time parts of the first date to 0, like:

    d = d.withTime(0, 0, 0, 0);
    

提交回复
热议问题