-
subtracting days from GregorianCalendar
Hi there,
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();
endDate.set(endYear,endMonth,endDay);
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?
Alan
-
Check out the methods add(), after() and before().
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks