Java Calendar Day getEndOfTodayAsCalendar()

Here you can find the source of getEndOfTodayAsCalendar()

Description

get End Of Today As Calendar

License

Apache License

Declaration

public static Calendar getEndOfTodayAsCalendar() 

Method Source Code

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

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

public class Main {
    /************************************************************************/
    public static Calendar getEndOfTodayAsCalendar() {
        return rollToEndOfDay(new Date());
    }/*from   w ww.j  a  va  2s. co  m*/

    /************************************************************************/
    public static GregorianCalendar rollToEndOfDay(Date date) {
        GregorianCalendar gregorianCalendar = new GregorianCalendar();
        gregorianCalendar.setTime(date);
        gregorianCalendar.set(Calendar.HOUR_OF_DAY, 23);
        gregorianCalendar.set(Calendar.MINUTE, 59);
        gregorianCalendar.set(Calendar.SECOND, 59);
        gregorianCalendar.set(Calendar.MILLISECOND, 999);
        return gregorianCalendar;
    }
}

Related

  1. getDayString(Calendar cal1)
  2. getDayStringByCalendar(Calendar calendar)
  3. getEndDay(Calendar cal)
  4. getEndOfDay(Calendar c)
  5. getEndOfDay(Date date, Calendar cal)
  6. getFirstDay(Calendar cal)
  7. getGregorianDay(Calendar cal)
  8. getJulianDay(Calendar currentDate)
  9. getLastDay(Date targetDate, Calendar cal)