Here you can find the source of truncateDay(Calendar calendar)
Parameter | Description |
---|---|
calendar | a parameter |
public static Calendar truncateDay(Calendar calendar)
//package com.java2s; //License from project: Apache License import java.util.Calendar; public class Main { /**//from w w w .j ava2 s . c o m * Truncate the calendar's Calendar.HOUR, Calendar.MINUTE, Calendar.SECOND, Calendar.MILLISECOND to ZERO. * * @param calendar * @return */ public static Calendar truncateDay(Calendar calendar) { if (calendar == null) { throw new IllegalArgumentException("input is null"); } calendar.set(Calendar.AM_PM, Calendar.AM); calendar.set(Calendar.HOUR, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar; } }