Here you can find the source of getFirstTimeInDay(Date day)
public static Date getFirstTimeInDay(Date day)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.*; public class Main { public static Date getFirstTimeInDay(Date day) { Calendar date = Calendar.getInstance(); date.setTime(day);/*from ww w . ja v a 2 s . c om*/ date.set(Calendar.HOUR_OF_DAY, 0); date.set(Calendar.MINUTE, 0); date.set(Calendar.SECOND, 0); date.set(Calendar.MILLISECOND, 0); return date.getTime(); } public static String getTime() { Date currentTime = new Date(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String dateString = formatter.format(currentTime); String min; min = dateString.substring(14, 16); return min; } }