Java Calendar Month calToLastDayOfMonth(Calendar c)

Here you can find the source of calToLastDayOfMonth(Calendar c)

Description

cal To Last Day Of Month

License

Open Source License

Declaration

public static synchronized void calToLastDayOfMonth(Calendar c) 

Method Source Code

//package com.java2s;

import java.util.Calendar;

public class Main {
    public static synchronized void calToLastDayOfMonth(Calendar c) {
        int day = lastDayOfMonth(c);
        c.set(Calendar.DATE, day);
    }//  w  w w. j  a  va  2s .c om

    public static synchronized int lastDayOfMonth(Calendar c) {
        // final int[] daysPerMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31,
        // 30, 31};
        // int month = c.get(Calendar.MONTH);
        // return daysPerMonth[month];
        return c.getActualMaximum(Calendar.DATE);
    }
}

Related

  1. calendarMonthToInt(int calendarMonth)
  2. convertRemoveAfterMonth(Calendar cal)
  3. endOfMonth(Calendar calendar)
  4. floorDayOfMonth(Calendar cal)
  5. getCalDayofMonth(Date calendarDay)