【发布时间】:2011-05-07 05:29:46
【问题描述】:
我以前从未使用过JodaTime,但回答这个问题时,How to get ordinal Weekdays in a Month。
我试过了,想出了这个丑陋的代码来取消设置下面的所有字段:
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 中做这件事的首选习惯用法是什么?
【问题讨论】: