long z = 0;
for (int k = 0; k < 6; k++) { // 6 weeks per monthly summary
Week week = new Week();
for (int i = 0; i < 7; i++) { // 7 days a week
Calendar tCal = Calendar.getInstance(timezone);
tCal.setTimeInMillis(startWeekDay.getTimeInMillis()
+ (z * 86400000L));
Day day = new Day(tCal.getTime());
for (Appointment appointment : appointments) {
if (appointment
.appointmentStartAsCalendar(timezone).get(
Calendar.MONTH) == tCal
.get(Calendar.MONTH)
&& appointment.appointmentStartAsCalendar(
timezone).get(Calendar.DATE) == tCal
.get(Calendar.DATE)) {
day.getAppointments().add(
new AppointmentDTO(appointment,
timezone));
}
}
week.getDays().add(day);
z++;
}
weeks.add(week);
}