Here you can find the source of getStartAndEndDate(Date d)
public static Date[] getStartAndEndDate(Date d)
//package com.java2s; /*/*from ww w . j a v a 2 s . c om*/ * All GTAS code is Copyright 2016, Unisys Corporation. * * Please see LICENSE.txt for details. */ import java.util.Calendar; import java.util.Date; public class Main { /** * return starting and ending dates within a day */ public static Date[] getStartAndEndDate(Date d) { Calendar cal = Calendar.getInstance(); cal.setTime(d); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); Date startDate = cal.getTime(); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); Date endDate = cal.getTime(); return new Date[] { startDate, endDate }; } }