Java Day End getEndDate(Date date)

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

Description

get End Date

License

Open Source License

Declaration

public static Date getEndDate(Date date) 

Method Source Code

//package com.java2s;

import java.util.Calendar;

import java.util.Date;

public class Main {
    public static Date getEndDate(Date date) {
        Calendar calendar = getFirstOfMonthCalendar(date);
        calendar.add(Calendar.MONTH, 1);
        calendar.add(Calendar.MILLISECOND, 1);
        return calendar.getTime();
    }/* w  ww  . j av  a  2 s . com*/

    public static Calendar getFirstOfMonthCalendar(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        return calendar;
    }
}

Related

  1. getDateTimeString(boolean appendMillis)
  2. getDefaultEndDateForLogQuery()
  3. getDistDates(Date startDate, Date endDate)
  4. getEndDate()
  5. getEndDate(Date beginDate, int resolution)
  6. getEndDate(Date startDate)
  7. getEndDate(int useMonth)
  8. getEndDate(String date)
  9. getEndDateByDate(Date date)