Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static int getDay(int y, int m, int d) { if (m < 0 || m > 11) return -1; Calendar c = Calendar.getInstance(); c.set(Calendar.YEAR, y); c.set(Calendar.MONTH, m); c.set(Calendar.DATE, d); return c.get(Calendar.DAY_OF_WEEK) - 1; } }