Here you can find the source of getFirstMinuteOfDay(Calendar dt)
Parameter | Description |
---|---|
Calendar | a parameter |
public static Calendar getFirstMinuteOfDay(Calendar dt)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { /**//from w w w.ja v a 2s. c o m * * Get Calendar (am 00:00) * @param Calendar * @return Calendar */ public static Calendar getFirstMinuteOfDay(Calendar dt) { if (null == dt) { return null; } Calendar calendar = dt; Calendar rtnCalendar = Calendar.getInstance(); rtnCalendar.clear(); rtnCalendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR)); rtnCalendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH)); rtnCalendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH)); return rtnCalendar; } /** * * Get Date (am 00:00) * @param Date * @return Date */ public static Date getFirstMinuteOfDay(Date dt) { if (null == dt) { return null; } Calendar calendar = Calendar.getInstance(); calendar.setTime(dt); Calendar rtnCalendar = Calendar.getInstance(); rtnCalendar.clear(); rtnCalendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR)); rtnCalendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH)); rtnCalendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH)); return rtnCalendar.getTime(); } }