Java Calendar Month getLastDayOfMonth(Calendar c)

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

Description

get Last Day Of Month

License

Open Source License

Declaration

public static Date getLastDayOfMonth(Calendar c) 

Method Source Code

//package com.java2s;

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static Date getLastDayOfMonth(Calendar c) {
        int year = c.get(Calendar.YEAR);
        int month = c.get(Calendar.MONTH) + 1;
        int day = 1;
        if (month > 11) {
            month = 0;//from   w  w  w  .j ava2 s . co  m
            year = year + 1;
        }
        c.set(year, month, day - 1, 0, 0, 0);
        return c.getTime();
    }
}

Related

  1. getFirstDayOfMonth(Calendar c)
  2. getFirstDayOfMonth(Calendar cal)
  3. getFirstDayOfMonth(final Calendar calendar, final Date date)
  4. getLastDateOfMonth(Calendar calendar)
  5. getLastDayOfMonth(Calendar c)
  6. getLastDayOfMonth(Calendar calendar)
  7. getLastMonthDays(Calendar c)
  8. getMonth(Calendar c)
  9. getMonth(Calendar cal)