Here you can find the source of today()
public static long today()
//package com.java2s; //License from project: Apache License import java.util.Calendar; public class Main { public static long today() { return dayFromDatetime(System.currentTimeMillis()); }// w ww . ja v a2 s . c o m public static long dayFromDatetime(long datetime) { Calendar cal = new java.util.GregorianCalendar(); cal.setTimeInMillis(datetime); // today cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime().getTime(); } }