Java Date Start getStartOfDay(Date day)

Here you can find the source of getStartOfDay(Date day)

Description

get Start Of Day

License

Apache License

Declaration

public static long getStartOfDay(Date day) 

Method Source Code

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

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

public class Main {
    public static long getStartOfDay(Date day) {
        Calendar startOfDay = Calendar.getInstance();
        startOfDay.setTime(day);//from w  ww  . j a  v a2s.c o m

        startOfDay.set(Calendar.HOUR_OF_DAY, 0);
        startOfDay.set(Calendar.MINUTE, 0);
        startOfDay.set(Calendar.SECOND, 0);
        startOfDay.set(Calendar.MILLISECOND, 0);

        return startOfDay.getTimeInMillis();
    }
}

Related

  1. getStartDay(Date date)
  2. getStartDayOfNextMonth(Date date)
  3. getStartOfDate(final Date date)
  4. getStartOfDay(Date date)
  5. getStartOfDay(Date date)
  6. getStartOfDay(Date day)
  7. getStartOfMonth(Date date)
  8. getStartOfMonth(Date dt)
  9. getStartOfMonth(Date dt)