Java Week Day getDayOfWeek(Date date)

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

Description

get Day Of Week

License

LGPL

Declaration

public static int getDayOfWeek(Date date) 

Method Source Code

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

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

public class Main {
    public static int getDayOfWeek(Date date) {
        return getField(date, Calendar.DAY_OF_WEEK);
    }/*from w w w  . j a  va 2 s  . com*/

    public static int getField(Date date, int field) {
        int result = -1;
        if (date != null) {
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(date);
            result = calendar.get(field);
        }
        return result;
    }
}

Related

  1. getDayOfWeek()
  2. getDayOfWeek(Date date)
  3. getDayOfWeek(Date date)
  4. getDayOfWeek(Date date)
  5. getDayOfWeek(Date date)
  6. getDayOfWeek(Date date, int day)
  7. getDayOfWeek(Date dt)
  8. getDayOfWeek(Date start, int day)
  9. getDayOfWeek(int _year, int _month, int _day)