Java Day End endOfDay(Date aDate)

Here you can find the source of endOfDay(Date aDate)

Description

Compute midnight of the date provided.

License

Apache License

Parameter

Parameter Description
aDate a parameter

Return

Midnight of the date provided.

Declaration

public static Date endOfDay(Date aDate) 

Method Source Code

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

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

public class Main {
    /**/*  w  ww  .ja  va 2s .c  o m*/
     * Compute midnight of the date provided.
     *
     * @param aDate
     * @return Midnight of the date provided.
     */
    public static Date endOfDay(Date aDate) {
        Calendar cal = GregorianCalendar.getInstance();
        cal.setTime(aDate);
        cal.set(Calendar.MILLISECOND, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.HOUR_OF_DAY, 24);
        Date midnight = cal.getTime();
        return midnight;
    }
}

Related

  1. daysOfTwoDate(Date beginDate, Date endDate)
  2. dayValue(Date date, boolean startEnd)
  3. deltaInDays(Date start, Date end)
  4. deltaMonths(Date start, Date end)
  5. divMonth(Date startDate, Date enDate)
  6. endOfDay(Date aDate)
  7. endOfDay(Date date)
  8. endOfDay(Date date)
  9. endOfDay(Date date)