0

Possible Duplicate:
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);

How to check today is between rdate and newdate?

Community
  • 1
  • 1
user1750832
  • 75
  • 1
  • 10
  • Use `java.util.Date` instead of `java.sql.Date` unless you are using JDBC. – Peter Lawrey Oct 18 '12 at 09:01
  • 2
    This question appears to be the same as your previous one. Voted to close as *exact duplicate*. – Lion Oct 18 '12 at 09:05
  • Just a tip for you! If you can use external libraries, joda time is a good tool for calculating dates etc. http://joda-time.sourceforge.net/ – heldt Oct 18 '12 at 09:08

3 Answers3

2
rdate.after(today)&&rdate.before(newdate)
kirschmichel
  • 903
  • 1
  • 8
  • 14
0

You can try the following:

 (today.after(rdate) && today.before(newdate) ||
 (today.after(newdate) && today.before(rdate))
Alex Stybaev
  • 4,623
  • 3
  • 30
  • 44
0

How about

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

assuming that newdate is always later than rdate, which your code comments suggest.

Cheers,

Anders R. Bystrup
  • 15,729
  • 10
  • 59
  • 55