How do you get the date/time range for “today” using the Joda date/time library in Java?

后端 未结 6 1757
故里飘歌
故里飘歌 2021-01-17 07:59

Assuming this is how you get the current time in Joda time:

DateTime now = new DateTime();

How do you calculate values for the variables

6条回答
  •  清歌不尽
    2021-01-17 08:25

    if((sinceDate.getDayOfYear() == now.getDayOfYear())  && (sinceDate.year() == now.year()))
       //yep, do something today;
    

    works for me.

提交回复
热议问题