Here you can find the source of currentDate()
public static Date currentDate()
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { /**//from w ww . jav a 2s.c o m * milliseconds in a second. */ public static final long SECOND = 1000; /** * milliseconds in a minute. */ public static final long MINUTE = SECOND * 60; /** * milliseconds in a hour. */ public static final long HOUR = MINUTE * 60; /** * @return the current date without time component */ public static Date currentDate() { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.set(Calendar.HOUR, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return new Date(calendar.getTimeInMillis()); } }