JodaTime 相当于 DateUtils.truncate()
我以前从未使用过JodaTime,但回答这个问题,如何在一个月内获得序数工作日。
我尝试了一下,想出了这个丑陋的代码来取消设置以下所有字段:
DateTime startOfMonth =
input.withDayOfMonth(1)
.withHourOfDay(0) // there
.withMinuteOfHour(0) // has got to
.withSecondOfMinute(0) // be a shorter way
.withMillisOfSecond(0); // to do this
使用DateUtils的Commons / Lang等效物将是
Date startOfMonth = DateUtils.truncate(input, Calendar.MONTH);
在JodaTime中这样做的首选成语是什么?