Here you can find the source of stripTime(Date date)
Parameter | Description |
---|---|
date | input |
public static Date stripTime(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { /**//from www. j a v a2 s .c om * Returns a Date object representing 00:00:00AM of the input date. * * @param date input * @return a Date object containing Time part as 00:00:00.000 AM. */ public static Date stripTime(Date date) { Calendar calendar = Calendar.getInstance(); calendar.clear(); Calendar copy = Calendar.getInstance(); copy.setTime(date); calendar.set(Calendar.DATE, calendar.get(Calendar.DATE)); calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH)); calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR)); return calendar.getTime(); } }