Here you can find the source of today()
public static java.sql.Date today()
//package com.java2s; // The MIT License (MIT) import java.util.Calendar; import java.util.GregorianCalendar; public class Main { public static java.sql.Date today() { return new java.sql.Date(todayCalendar().getTimeInMillis()); }/*w w w . ja va 2 s .c o m*/ public static Calendar todayCalendar() { Calendar cal = new GregorianCalendar(); clearTime(cal); return cal; } public static java.util.Date clearTime(java.util.Date d) { Calendar cal = new GregorianCalendar(); cal.setTime(d); clearTime(cal); return cal.getTime(); } public static void clearTime(Calendar cal) { cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); } }