今天两个日历之间的日历?

时间:2012-10-18 08:59:08

标签: java calendar

  

可能重复:
  Calendar <= another calendar

Calendar newdate = Calendar.getInstance(); // Collect before this date 
Calendar today = Calendar.getInstance();
rdate.setTime(converteddate);
newdate.setTime(converteddate);
newdate.add(Calendar.DATE, 7);

今天如何检查是在rdatenewdate之间?

3 个答案:

答案 0 :(得分:2)

rdate.after(today)&&rdate.before(newdate)

答案 1 :(得分:0)

您可以尝试以下操作:

 (today.after(rdate) && today.before(newdate) ||
 (today.after(newdate) && today.before(rdate))

答案 2 :(得分:0)

怎么样

if ( today.after( rdate ) && today.before( newdate ) ) { .... }

假设newdate总是晚于代码评论所暗示的rdate

干杯,