Here you can find the source of getEndOfTodayAsCalendar()
public static Calendar getEndOfTodayAsCalendar()
//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; } }