Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { private static Calendar calendar = Calendar.getInstance(); public static int getCurrentFirstWeekdayOfMoth() { int today = getCurrentDate(); calendar.set(Calendar.DATE, 1); int weekday = calendar.get(Calendar.DAY_OF_WEEK) - 1; calendar.set(Calendar.DATE, today); return weekday; } public static int getCurrentDate() { return calendar.get(Calendar.DATE); } }