Java Day Start startOfDay(Date value)

Here you can find the source of startOfDay(Date value)

Description

Return the start of a day containing a specified time

License

LGPL

Parameter

Parameter Description
value Specified time

Return

Start of day

Declaration

public static Date startOfDay(Date value) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

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

public class Main {
    /**/*from   w  w w .j a va  2  s . c  o  m*/
     * Return the start of a day containing a specified time
     * @param value Specified time
     * @return Start of day
     */
    public static Date startOfDay(Date value) {
        Calendar working = new GregorianCalendar();
        working.setTime(value);
        working.set(Calendar.HOUR_OF_DAY, 0);
        working.set(Calendar.MINUTE, 0);
        working.set(Calendar.SECOND, 0);
        working.set(Calendar.MILLISECOND, 0);
        return working.getTime();
    }
}

Related

  1. startOfDay(Date aDate)
  2. startOfDay(Date date)
  3. startOfDay(Date date)
  4. startOfDay(Date dateInst)
  5. startOfDay(Date inDate, TimeZone timeZone)
  6. startOfDay(final Date date)
  7. startOfDay(final Date date)
  8. startOfDayInMillis(long date)