Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { private static long beginningOfTheDay(Calendar time) { Calendar copy = (Calendar) time.clone(); copy.clear(); copy.set(time.get(Calendar.YEAR), time.get(Calendar.MONTH), time.get(Calendar.DAY_OF_MONTH)); return copy.getTimeInMillis(); } }