Last Friday of each month: Difference between revisions

→‎{{header|Java}}: fix bug: getShortMonths returns 13 elements, the last one may be an empty string
(→‎{{header|Java}}: fix bug: getShortMonths returns 13 elements, the last one may be an empty string)
Line 394:
 
for (String mon : new DateFormatSymbols(Locale.US).getShortMonths()) {
if (!mon.isEmpty()) {
int totalDaysOfMonth = c.setgetActualMaximum(Calendar.DAY_OF_MONTH, day);
c.set(Calendar.DAY_OF_MONTH, totalDaysOfMonth);
 
int totalDaysOfMonthdaysToRollBack = (c.getActualMaximumget(Calendar.DAY_OF_MONTHDAY_OF_WEEK) + 1) % 7;
c.set(Calendar.DAY_OF_MONTH, totalDaysOfMonth);
 
int day = totalDaysOfMonth - daysToRollBack;
int daysToRollBack = ( c.getset(Calendar.DAY_OF_WEEK)DAY_OF_MONTH, + 1day) % 7;
 
System.out.printf("%d %s %d\n", year, mon, day);
int day = totalDaysOfMonth - daysToRollBack;
c.set(Calendar.DAY_OF_MONTH, day);
System.out.printf("%d %s %d\n", year, mon, day);
 
c.set(year, c.get(Calendar.MONTH) + 1, 1);
}
}
}
Anonymous user