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

后端 未结 6 1706
故里飘歌
故里飘歌 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:37

    import org.joda.time.DateTime;
    import org.joda.time.DateTimeMidnight;
    
    DateTime dateTimeAtStartOfToday = new DateTime(new DateTimeMidnight());  
    DateTime dateTimeAtEndOfToday = new DateTime((new DateTimeMidnight()).plusDays(1));
    

提交回复
热议问题