Here you can find the source of getNoonOfDay(Date day, Calendar cal)
public static Date getNoonOfDay(Date day, Calendar cal)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { /**// ww w .j a va2 s. c o m * Returns a Date set just to Noon, to the closest possible millisecond * of the day. If a null day is passed in, a new Date is created. * nnoon (00m 12h 00s) */ public static Date getNoonOfDay(Date day, Calendar cal) { if (day == null) day = new Date(); cal.setTime(day); cal.set(Calendar.HOUR_OF_DAY, 12); cal.set(Calendar.MINUTE, cal.getMinimum(Calendar.MINUTE)); cal.set(Calendar.SECOND, cal.getMinimum(Calendar.SECOND)); cal.set(Calendar.MILLISECOND, cal.getMinimum(Calendar.MILLISECOND)); return cal.getTime(); } }