【发布时间】:2012-03-07 21:52:50
【问题描述】:
有没有办法只比较具有 isBefore 函数的 DateTime 对象的日期?
例如,
DateTime start = new DateTime(Long.parseLong(<someInput>));
DateTime end = new DateTime(Long.parseLong(<someInput>));
现在,当我这样做时,
while (start.isBefore(end)) {
// add start date to the list
start = start.plusDays(1);
}
这会导致不一致的行为(对于我的场景),因为它也考虑了时间,而我想要的只是使用 isBefore 比较日期。有什么办法可以做到吗?
请告诉我。
谢谢!
【问题讨论】: