Java Utililty Methods Calendar Month

List of utility methods to do Calendar Month

Description

The list of methods to do Calendar Month are organized into topic(s).

Method

voidsetDate(Calendar calendar, int month, int date)
Sets the given Calendar 's instance to a specific date.
calendar.clear();
calendar.set(Calendar.YEAR, Calendar.getInstance().get(Calendar.YEAR));
calendar.set(Calendar.MONTH, month);
calendar.set(Calendar.DATE, date);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
...
voidsetTimeAsFirstDayOfMonth(Calendar calendar)
set Time As First Day Of Month
calendar.set(Calendar.DAY_OF_MONTH, FIRST_DAY_OF_MONTH);
normalise(calendar);
CalendarsubtractMonths(Calendar date, int months)
Subtracts a given number of months from a date.
date.add(Calendar.MONTH, (int) months * -1);
return date;