Java Week Day getDayOfWeek(Date date)

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

Description

get Day Of Week

License

Open Source License

Declaration

public static int getDayOfWeek(Date date) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

import java.util.Locale;

public class Main {

    public static int getDayOfWeek(Date date) {
        return getField(date, Locale.getDefault(), Calendar.DAY_OF_WEEK);
    }/*w  w w  .jav a2  s  . c  om*/

    public static int getField(Date date, int calendarField) {
        return getField(date, Locale.getDefault(), calendarField);
    }

    public static int getField(Date date, Locale locale, int calendarField) {
        Calendar instance = Calendar.getInstance(locale);
        instance.setTime(date);
        return instance.get(calendarField);
    }
}

Related

  1. getDayNextWeek()
  2. getDayOfTheWeekFromNow(int nDays)
  3. getDayOfWeek()
  4. getDayOfWeek(Date date)
  5. getDayOfWeek(Date date)
  6. getDayOfWeek(Date date)
  7. getDayOfWeek(Date date)
  8. getDayOfWeek(Date date, int day)
  9. getDayOfWeek(Date dt)