Java SQL Date Create getLastDay(Date dt)

Here you can find the source of getLastDay(Date dt)

Description

get Last Day

License

Open Source License

Declaration

public static int getLastDay(Date dt) 

Method Source Code


//package com.java2s;
import java.sql.Date;

import java.util.Calendar;
import java.util.GregorianCalendar;

public class Main {
    public static int getLastDay(Date dt) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(dt);/* ww w .  j a v a 2s.  co m*/
        int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
        return lastDay;
    }

    public static int getLastDay(int yy, int mm) {

        GregorianCalendar gc = new GregorianCalendar(yy, mm - 1, 1);

        return gc.getActualMaximum(GregorianCalendar.DATE);
    }
}

Related

  1. getDays(Date from, Date to)
  2. getDaysLater(Date date, int days)
  3. getDayStart(Date stamp)
  4. getLastDateOfQuarter()
  5. getLastDay(Date date)
  6. getLastDay(java.util.Date dt)
  7. getLastDayofMonth(Date date1)
  8. getLastDayOfMonth(java.sql.Date date)
  9. getLastDayOfPreviousMonth(Date date, boolean isFormatDate)