Here you can find the source of dayPrecision(Calendar calendar)
Parameter | Description |
---|---|
calendar | calendar |
public static Calendar dayPrecision(Calendar calendar)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; public class Main { /**//from w ww . ja v a2s. c o m * Remove precision from a calendar so that it represents just a day. A new * instance is returned * * @param calendar calendar * @return new cal */ public static Calendar dayPrecision(Calendar calendar) { Calendar cal = Calendar.getInstance(); cal.setTime(calendar.getTime()); cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.HOUR_OF_DAY, 0); return cal; } }