Here you can find the source of startOfToday()
public static long startOfToday()
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static long startOfToday() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); Date date = calendar.getTime(); return date.getTime(); }//ww w. jav a 2 s .c om }