Here you can find the source of getTodayLimit()
public static Date getTodayLimit()
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static Date getTodayLimit() { return getDateEndTime(new Date()); }//from ww w. j av a 2 s. c om public static Date getDateEndTime(Date date) { if (date == null) return null; Calendar c = Calendar.getInstance(); c.setTime(date); c.add(Calendar.DAY_OF_MONTH, 1); setCalendarToZero(c); return c.getTime(); } /** * * @param c * @return */ public static void setCalendarToZero(Calendar c) { c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); } }