Java Day End setTimeToEndOfDay(Date date)

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

Description

set Time To End Of Day

License

Apache License

Declaration

public static Date setTimeToEndOfDay(Date date) 

Method Source Code

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

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

public class Main {
    public static Date setTimeToEndOfDay(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);// w ww  .ja  va 2 s .  c o  m
        c.set(Calendar.HOUR_OF_DAY, 23);
        c.set(Calendar.MINUTE, 59);
        c.set(Calendar.SECOND, 59);
        c.set(Calendar.MILLISECOND, 999);
        return c.getTime();
    }
}

Related

  1. secondsBetween(Date start, Date end, boolean assumeSameDate, boolean assumeSameHour)
  2. secondsToEndOfDay(Date aDate)
  3. secondsToEndOfDay(Date aDate)
  4. setEndDay(Date date)
  5. setTimeToEndofDay(Calendar calendar)
  6. subtractSecond(Date startDate, Date endDate)
  7. toDayEnds(Date date)
  8. toDayInterval(Date startDate, Date endDate)
  9. todayOnOrBetween(Date startDate, Date endDate)