Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static Calendar clearTime(Calendar calendar) { calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar; } public static long clearTime(long time) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(time); return clearTime(calendar).getTimeInMillis(); } }