Here you can find the source of getDayOfWeek(Date date)
public static int getDayOfWeek(Date date)
//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); } }