Java Day End endOfDay(Date value)

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

Description

Return the end of a day containing a specified time

License

LGPL

Parameter

Parameter Description
value Specified time

Return

Start of day

Declaration

public static Date endOfDay(Date value) 

Method Source Code


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

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

public class Main {
    /**// w ww  . ja  v  a 2 s  . c om
     * Return the end of a day containing a specified time
     * @param value Specified time
     * @return Start of day
     */
    public static Date endOfDay(Date value) {
        Calendar working = new GregorianCalendar();
        working.setTime(value);
        working.set(Calendar.HOUR_OF_DAY, 23);
        working.set(Calendar.MINUTE, 59);
        working.set(Calendar.SECOND, 59);
        working.set(Calendar.MILLISECOND, 999);
        return working.getTime();
    }
}

Related

  1. endOfDay(Date date)
  2. endOfDay(Date date)
  3. endOfDay(Date dateInst)
  4. endOfDay(Date dt)
  5. endOfDay(Date inDate, TimeZone timeZone)
  6. endOfDay(final Date date)
  7. endOfDay(final Date date)
  8. endOfDayDate(Date date)
  9. endOfDayInMillis(long date)