Here you can find the source of toDay()
public static Date toDay()
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Date toDay() { return removeTime(new Date()); }//from w w w . j a v a 2s . co m /** * This method remove the time attributes of date object * * @param date object parameter * @return a java.util.Date object without time attributes */ public static Date removeTime(Date date) { if (date != null) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(date.getTime()); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); } return null; } }