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
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