subtracting days from GregorianCalendar
How does one subtract, let's say, 7 days from a given GregorianCalendar instance. Let's say I want to set up two instances on GregorianCalendar. The first one has a known date, like so:
int endYear = 2005;
int endMonth = 7;
int endDay = 6;
GregorianCalendar endDate = new GregorianCalendar();
How do I set up a second instance of GregorianCalendar set to 7 days prior to the endDate instance?
GregorianCalendar nearDate = new GregorianCalendar();
What I want to do here is make a comparison with todays date (a third instance of GregorianCalendar that is set to todays date), to see if todays date is within the range between endDate and nearDate.
Can someone please help?
Check out the methods add(), after() and before().
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center