Just curious, does it have to be GregorianCalendar or should you be using the generic Calendar class? Not that it truly matters to the answer, but it is shorter to just type "Calendar" and it more generic To get the current date,
To get the date of one week ago:
To get the date two weeks hence:
(Note that you add three weeks, because we took one week away in the previous step. You could also get a new instance of the Calendar and add two weeks...this would produce more readable code, but is less efficient) Once you have the start date and the end date, see here to get the list of dates between the two. You can then display the dates either using the .toString() method or, more likely, create a java.text.SimpleDateFormat to format the dates for you.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
thanx joel , u've got it exactally what i want but can u please write a small java code for this problem, i dunno where i'm making the mistake,cant send u my code coz its too long,so just send me as soon as possible.
Joined: Apr 06, 2003
thanx joel , u've got it exactally what i want but can u please write a small java program for this problem, i dunno where i'm making the mistake,cant send u my code coz its too long,so just send me as soon as possible.
Joined: Aug 20, 2001
You should easily be able to create the java program from the code above and in the related link referenced above. If you are having other problems with your code (displaying the date, etc.) post them and we will be happy to help you with your problems. If you feel that your code is too long to post here, feel free to send it to me via e-mail and I will take a look and see. While you can get my e-mail address from my profile, I'll save you the click: firstname.lastname@example.org