Java Day End endOfDay(final Date date)

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

Description

end Of Day

License

Open Source License

Declaration

public static Calendar endOfDay(final Date date) 

Method Source Code


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

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

public class Main {
    public static Calendar endOfDay(final Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);//ww  w .  ja va  2 s . co m
        setEndOfDay(calendar);

        return calendar;
    }

    public static void setEndOfDay(final Calendar calendar) {
        calendar.add(Calendar.DAY_OF_MONTH, 1);
        setStartOfDay(calendar);
    }

    public static void setStartOfDay(final Calendar calendar) {
        calendar.set(Calendar.HOUR, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
    }
}

Related

  1. endOfDay(Date dateInst)
  2. endOfDay(Date dt)
  3. endOfDay(Date inDate, TimeZone timeZone)
  4. endOfDay(Date value)
  5. endOfDay(final Date date)
  6. endOfDayDate(Date date)
  7. endOfDayInMillis(long date)
  8. endOfTheMonth(java.util.Date date, Locale locale)
  9. endOfYear(Date referenceDate, TimeZone timeZone)