Here you can find the source of getTodayLast()
public static Date getTodayLast()
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static Date getTodayLast() { Calendar cal = Calendar.getInstance(); cal.setTime(getTodayZero());//w w w.j a v a 2 s . c om cal.add(Calendar.DAY_OF_MONTH, 1); cal.add(Calendar.MILLISECOND, -1); return cal.getTime(); } public static Date getTodayZero() { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); } }