Java Day End endOfDay(Date date)

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

Description

Sets the time field of given date to 24:00:00:00.

License

Open Source License

Parameter

Parameter Description
date a parameter

Declaration

public static Date endOfDay(Date date) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;

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

public class Main {
    /**//from w w  w .  ja va 2s .  c  o m
     * 
     * Sets the time field of given date to 24:00:00:00. Date field rolls 1 day
     * up.
     * 
     * @param date
     * @return
     */
    public static Date endOfDay(Date date) {
        GregorianCalendar endOfDay = new GregorianCalendar();
        endOfDay.setTime(date);
        // 24 saat seklindeki saat set ediliyor
        endOfDay.set(Calendar.HOUR_OF_DAY, 24);
        endOfDay.set(Calendar.SECOND, 0);
        endOfDay.set(Calendar.MINUTE, 0);
        endOfDay.set(Calendar.MILLISECOND, 0);
        // System.out.println(endOfDay.getTime());
        return endOfDay.getTime();
    }
}

Related

  1. deltaMonths(Date start, Date end)
  2. divMonth(Date startDate, Date enDate)
  3. endOfDay(Date aDate)
  4. endOfDay(Date aDate)
  5. endOfDay(Date date)
  6. endOfDay(Date date)
  7. endOfDay(Date date)
  8. endOfDay(Date dateInst)
  9. endOfDay(Date dt)