List of utility methods to do Calendar Year
void | setCalendarFields(Calendar cal, int year, int month, int day, int hour, int minute, int second, int millis) set Calendar Fields if (year <= 0) { cal.set(Calendar.ERA, GregorianCalendar.BC); cal.set(Calendar.YEAR, 1 - year); } else { cal.set(Calendar.ERA, GregorianCalendar.AD); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month - 1); ... |
void | setDate(Calendar cal, int year, int month, int day) set Date cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month - 1); cal.set(Calendar.DATE, day); |
GregorianCalendar | toCalendar(int year, int month, int day, int hour, int minutes, int seconds) to Calendar GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC")); calendar.set(Calendar.MILLISECOND, 0); calendar.set(year, month - 1, day, hour, minutes, seconds); return calendar; |
String | toStringYearMonth(Calendar calendar) to String Year Month String yyyy = String.valueOf(calendar.get(Calendar.YEAR) + BUDDHIST_YEAR); String mm = String.valueOf(calendar.get(Calendar.MONTH) + 1); if (mm.length() < 2) { mm = "0" + mm; return yyyy + mm; |
void | truncCalendarToHalfYear(Calendar c) truncate the calendar to half year (i.e. if (c == null) { return; int month = c.get(Calendar.MONTH); truncCalendarToYear(c); if (month >= Calendar.JULY) { c.set(Calendar.MONTH, Calendar.JULY); |
void | truncCalendarToYear(Calendar c) truncate the calendar to year if (c == null) { return; c.set(Calendar.MONTH, Calendar.JANUARY); c.set(Calendar.DATE, 1); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); ... |
int | year(Calendar calendar) year return calendar.get(Calendar.YEAR);
|
int | year(Calendar date) year return date.get(Calendar.YEAR);
|