Here you can find the source of dayOfWeek(Date date)
public static int dayOfWeek(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static int dayOfWeek(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date);// w w w.ja va2 s .co m int dayWeek = cal.get(Calendar.DAY_OF_WEEK); return dayWeek; } public static int dayOfWeek(int year, int month, int day) { Calendar cal = Calendar.getInstance(); cal.set(year, month - 1, day); int dayWeek = cal.get(Calendar.DAY_OF_WEEK); return dayWeek; } }