JodaTime equivalent of DateUtils.truncate()

前端 未结 4 941
慢半拍i
慢半拍i 2020-12-05 09:38

I have never used JodaTime before, but answering this question, How to get ordinal Weekdays in a Month.

I tried it and came up with this ugly code to unset all fiel

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-05 09:50

    Use the withMillisOfDay() method to shorten the syntax.

    DateTime startOfMonth = input.withDayOfMonth(1).withMillisOfDay(0);
    

提交回复
热议问题