Java Date to Day getDay(Date date)

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

Description

Extracts the day value from the given date.

License

Open Source License

Parameter

Parameter Description
date a parameter

Declaration

public static int getDay(Date date) 

Method Source Code

//package com.java2s;

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

public class Main {
    /**/*ww w  . j av a  2 s  .c  o m*/
     * Extracts the day value from the given date.
     * 
     * @param date
     * @return
     */
    public static int getDay(Date date) {
        if (date == null) {
            return 0;
        }
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        return cal.get(Calendar.DATE);
    }
}

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)
  7. getDay(Date date)