import java.util.Date;
public class Util{
/**
* Sets the time on the same day to 00:00:00.000
*
* @param date
* @return a new date
*/
@SuppressWarnings("deprecation")
public static Date truncateTime(Date date) {
Date newDate = (Date) date.clone();
newDate.setHours(0);
newDate.setMinutes(0);
newDate.setSeconds(0);
newDate.setTime(newDate.getTime() - newDate.getTime() % 1000); //Millisekunden auf 0
return newDate;
}
}