Here you can find the source of getTodayStartTime()
public static long getTodayStartTime()
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final String FORMAT_DATE_YYYY_MM_DD = "yyyy-MM-dd"; private static final String FORMAT_DATE_AND_TIME_YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm"; public static long getTodayStartTime() { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat(FORMAT_DATE_YYYY_MM_DD); String strDate = sdf.format(date); Date date2 = null;/*from w w w. j a va2 s .c om*/ try { date2 = sdf.parse(strDate); SimpleDateFormat sdf2 = new SimpleDateFormat( FORMAT_DATE_AND_TIME_YYYY_MM_DD_HH_MM); String strDate2 = sdf2.format(date2); Date date3 = sdf2.parse(strDate2); return date3.getTime(); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return 0; } }