Here you can find the source of getDayStartTime(long time)
public static long getDayStartTime(long time)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static long getDayStartTime(long time) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(time);//w ww. j a va2 s . c o m SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); String strDay = sf.format(cal.getTime()); long result; try { result = sf.parse(strDay).getTime(); } catch (ParseException e) { result = time; } return result; } }