Java Date to Day getDay(Date date)

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

Description

Gets the day.

License

Open Source License

Parameter

Parameter Description
date the date

Return

the day

Declaration

public static Date getDay(Date date) 

Method Source Code

//package com.java2s;

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

public class Main {
    /**// w w  w .  j  a v a2s .c  om
     * Gets the day.
     * 
     * @param date
     *            the date
     * 
     * @return the day
     */
    public static Date getDay(Date date) {
        if (date == null) {
            return null;
        }
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        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();
    }
}

Related

  1. getDay(Date d)
  2. getDay(Date date)
  3. getDay(Date date)
  4. getDay(Date date)
  5. getDay(Date date)
  6. getDay(Date date)