Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to find comming sundays date.

Status
Not open for further replies.

brahman

Programmer
Apr 17, 2003
21
0
0
IN
i am writing a code to find the date of coming sundays.
The code is as follows.

Calendar myCalendar = Calendar.getInstance();
int day=myCalendar.get(Calendar.DAY_OF_WEEK);
int dateTemp=myCalendar.get(Calendar.DATE);
int date=8-day+dateTemp;
int year=myCalendar.get(Calendar.YEAR);
int month=myCalendar.get(Calendar.MONTH)+1;
String srchdate= date + "-" + month + "-" + year;

I know what the problem is can anybody help me in this.
The problem with this code is that it is not taking care of the change in month or year.
can anybody put some light on it.
Bye for now
amit
 
brahman, welcome to Tek-Tips [cheers]

TT has a great Keyword Search facility to find previously given solutions, check it out. However in this case you should not have needed to look any further than the first page of threads displayed in this forum. Since there is one with the subject Find what date monday was to see that thread click here: thread269-551917


-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top