Java SQL Date Create getLastDay(Date date)

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

Description

get Last Day

License

Apache License

Declaration

public static Date getLastDay(Date date) 

Method Source Code


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

import java.sql.Date;

import java.util.Calendar;

public class Main {
    /**/*from   w  w  w  .ja  v  a 2s . c  o m*/
     * 
    * get the last date of the month
    * @param date
    * @return
    * Date  
    * @throws
     */
    public static Date getLastDay(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.add(Calendar.MONTH, 1);
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        calendar.add(Calendar.DAY_OF_MONTH, -1);
        Date date2 = new Date(calendar.getTimeInMillis());
        return date2;
    }
}

Related

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