Java Day End endOfDay(Date date)

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

Description

Setzt die Uhrzeit eines Datums auf 23:59:59.999.

License

Open Source License

Parameter

Parameter Description
date das Datum.

Return

das neue Datum.

Declaration

public static Date endOfDay(Date date) 

Method Source Code

//package com.java2s;

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

public class Main {
    /**/*from   www.j a  v a  2 s.c o  m*/
     * Setzt die Uhrzeit eines Datums auf 23:59:59.999.
     * @param date das Datum.
     * @return das neue Datum.
     */
    public static Date endOfDay(Date date) {
        if (date == null)
            return null;

        Calendar cal = Calendar.getInstance();
        cal.setTime(date == null ? new Date() : date);
        cal.set(Calendar.HOUR_OF_DAY, 23);
        cal.set(Calendar.MINUTE, 59);
        cal.set(Calendar.SECOND, 59);
        cal.set(Calendar.MILLISECOND, 999);
        return cal.getTime();
    }
}

Related

  1. divMonth(Date startDate, Date enDate)
  2. endOfDay(Date aDate)
  3. endOfDay(Date aDate)
  4. endOfDay(Date date)
  5. endOfDay(Date date)
  6. endOfDay(Date date)
  7. endOfDay(Date dateInst)
  8. endOfDay(Date dt)
  9. endOfDay(Date inDate, TimeZone timeZone)