Java Date Set setToDayStartTime(Date date)

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

Description

set To Day Start Time

License

Apache License

Declaration

private static Date setToDayStartTime(Date date) 

Method Source Code

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

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

public class Main {

    private static Date setToDayStartTime(Date date) {
        Calendar calendar = Calendar.getInstance();

        calendar.setTimeInMillis(date.getTime());
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);

        return calendar.getTime();
    }/*from w w w.jav a 2  s  . co  m*/
}

Related

  1. setTimeForDate(Date date, int h, int m, int s)
  2. setTimePart(Date date, String time, Integer milliseconds)
  3. setTimeToNull(Date date)
  4. setTimeToZero(final Date date)
  5. setTimeZero(Date dt)
  6. setToLastDayInMonth(final Date date)
  7. setToMidnight(Date d)
  8. setYear(Date d, int year)
  9. setYear(Date date, int year)