Java Day of Month getLastDayOfMonth(int year, int month)

Here you can find the source of getLastDayOfMonth(int year, int month)

Description

get Last Day Of Month

License

LGPL

Declaration

public static Date getLastDayOfMonth(int year, int month) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

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

public class Main {

    public static Date getLastDayOfMonth(int year, int month) {
        Calendar c = Calendar.getInstance();
        c.set(Calendar.YEAR, year);
        c.set(Calendar.MONTH, month - 1);
        c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
        c.set(Calendar.HOUR, 0);//w w w  .ja v a 2s .c o  m
        c.set(Calendar.MINUTE, 0);
        c.set(Calendar.SECOND, 0);
        c.set(Calendar.MILLISECOND, 0);
        return c.getTime();
    }
}

Related

  1. getLastDayOfMonth(Date firstDate)
  2. getLastDayOfMonth(Date now)
  3. getLastDayOfMonth(Date sDate)
  4. getLastDayOfMonth(final Date date)
  5. getLastdayOfMonth(int month, int year)
  6. getLastDayOfMonth(int year, int month)
  7. getLastDayOfMonth(int year, int month)
  8. getLastDayOfMonth(int year, int month)
  9. getLastDayOfMonth(int year, int month)