Java Date Clear clearTime(Date date)

Here you can find the source of clearTime(Date date)

Description

clear Time

License

Open Source License

Declaration

public static Date clearTime(Date date) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static Date clearTime(Date date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);//from ww w  .  j  ava  2  s  . c om
        cal.clear(Calendar.HOUR_OF_DAY);
        cal.clear(Calendar.MINUTE);
        cal.clear(Calendar.SECOND);
        cal.clear(Calendar.MILLISECOND);
        return cal.getTime();
    }
}

Related

  1. clearDate(Date dateTime)
  2. clearDate(final Date date)
  3. clearDisplayFileCreationDateCache(final String absolutePath)
  4. clearHourMinute(Date date)
  5. clearTime(Date date)
  6. clearTime(GregorianCalendar date)
  7. clearTimeComponent(Date date)