所以我花了相当多的时间在谷歌上搜索并浏览了一些东西,但我就是无法让它发挥作用。即使 request.getEnd() 是在当前 startCal.getTime 之后几天,它也不会认为该语句为 true。有什么想法吗?
while(startCal.after(request.getEnd()))
{
/* Calculate new beginning */
startCal.add(Calendar.DATE, 1);
newBegin = startCal.getTime();
System.out.println(newBegin);
/* Calculate new ending */
endCal.add(Calendar.DATE, 1);
newEnd = endCal.getTime();
/* Setting new dates and series ID */
localRequest.setBegin(newBegin);
localRequest.setEnd(newEnd);
localRequest.setSeriesID(seriesID);
/* Sending new reservation to database */
//reserve(localRequest);
System.out.println("RESERVATION DONE");
}
最佳答案
even though the request.getEnd() is a couple days after the current startCal.getTime.
那么它无法启动也是有道理的!这行代码:
while(startCal.after(request.getEnd()))
表示“开始校准是在请求结束之后。”您所描述的数据恰恰相反!
关于java - 带有 Calendar.after 的 While 语句未启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16846179/