andrewbadera
Programmer
I have a project scheduler I'm building, and I seem to be able to move back and forth between weeks just fine with:
if (actionCmd == "nextWeek"
{
cal.set(Calendar.WEEK_OF_YEAR, (cal.get(Calendar.WEEK_OF_YEAR) + 1));
}
if (actionCmd == "prevWeek"
{
cal.set(Calendar.WEEK_OF_YEAR, (cal.get(Calendar.WEEK_OF_YEAR) - 1));
}
However, I'm generating a Monday/Friday date for each week using:
Calendar calStart = new GregorianCalendar();
calStart.setTime(rsTimelines.getDate("dateStart"
);
//System.out.println("date: " + calStart.get(Calendar.YEAR) + "-" + calStart.get(Calendar.MONTH) + "-" + calStart.get(Calendar.DAY_OF_MONTH) + " DAY_OF_WEEK: " + calStart.get(Calendar.DAY_OF_WEEK));
Calendar calEndProj = new GregorianCalendar();
calEndProj.setTime(rsTimelines.getDate("dateEndProj"
);
Calendar calSDate = new GregorianCalendar();
calSDate.setTime(sDate);
Calendar calEDate = new GregorianCalendar();
calEDate.setTime(eDate);
So each time the next/previous button is clicked, the date gets moved up or back a week, and I take a new instance of the calendar to generate my Monday/Friday dates. only it seems that the Monday/Friday dates remain static, the original Monday/Friday of the original week. Is there some sort of re-init or validate or update I need to call on the original Calendar before I getInstance for Mondays and Fridays?
if (actionCmd == "nextWeek"
cal.set(Calendar.WEEK_OF_YEAR, (cal.get(Calendar.WEEK_OF_YEAR) + 1));
}
if (actionCmd == "prevWeek"
cal.set(Calendar.WEEK_OF_YEAR, (cal.get(Calendar.WEEK_OF_YEAR) - 1));
}
However, I'm generating a Monday/Friday date for each week using:
Calendar calStart = new GregorianCalendar();
calStart.setTime(rsTimelines.getDate("dateStart"
//System.out.println("date: " + calStart.get(Calendar.YEAR) + "-" + calStart.get(Calendar.MONTH) + "-" + calStart.get(Calendar.DAY_OF_MONTH) + " DAY_OF_WEEK: " + calStart.get(Calendar.DAY_OF_WEEK));
Calendar calEndProj = new GregorianCalendar();
calEndProj.setTime(rsTimelines.getDate("dateEndProj"
Calendar calSDate = new GregorianCalendar();
calSDate.setTime(sDate);
Calendar calEDate = new GregorianCalendar();
calEDate.setTime(eDate);
So each time the next/previous button is clicked, the date gets moved up or back a week, and I take a new instance of the calendar to generate my Monday/Friday dates. only it seems that the Monday/Friday dates remain static, the original Monday/Friday of the original week. Is there some sort of re-init or validate or update I need to call on the original Calendar before I getInstance for Mondays and Fridays?