Here you can find the source of setMinDate(Date d)
public static Date setMinDate(Date d)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Date setMinDate(Date d) { Calendar min = Calendar.getInstance(); min.setTime(d);// w w w . j ava2s .c om if (min.get(Calendar.AM_PM) == Calendar.AM) { min.set(Calendar.HOUR, 0); } else { min.set(Calendar.HOUR, -12); } min.set(Calendar.MINUTE, min.getActualMinimum(Calendar.MINUTE)); min.set(Calendar.SECOND, min.getActualMinimum(Calendar.SECOND)); min.set(Calendar.MILLISECOND, min.getActualMinimum(Calendar.MILLISECOND)); return min.getTime(); } }