Android Day in Month Get lastDayOfMonth(Date date)

Here you can find the source of lastDayOfMonth(Date date)

Description

last Day Of Month

License

Open Source License

Declaration

public static Date lastDayOfMonth(Date date) 

Method Source Code

//package com.java2s;
import java.util.Calendar;

import java.util.Date;

public class Main {
    public static Date lastDayOfMonth(Date date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);//w ww  .  j  a  va2  s. c o  m
        cal.set(Calendar.DAY_OF_MONTH, Calendar.getInstance()
                .getActualMaximum(Calendar.DAY_OF_MONTH));
        cal.set(Calendar.HOUR_OF_DAY, Calendar.getInstance()
                .getActualMaximum(Calendar.HOUR_OF_DAY));
        cal.set(Calendar.MINUTE,
                Calendar.getInstance().getActualMaximum(Calendar.MINUTE));
        return cal.getTime();
    }
}

Related

  1. getFirstDayOfMonth(String format)
  2. getFirstDayOfMonth(String format)
  3. getLastDayOfMonth(String format)
  4. getLastDayOfMonth(String format)
  5. firstDayOfMonth(Date date)
  6. monthDays(int y, int m)