Here you can find the source of getFirstOfMonthDayOfWeek(GregorianCalendar aCalendar)
Parameter | Description |
---|---|
aCalendar | a GregorianCalendar to query |
public static int getFirstOfMonthDayOfWeek(GregorianCalendar aCalendar)
//package com.java2s; import java.util.Calendar; import java.util.GregorianCalendar; public class Main { /**/*from www . ja va 2s . c o m*/ * Gets the day of the week for the first day of the month. * * @param aCalendar a GregorianCalendar to query * * @return a value like get(DAY_OF_WEEK) where the first day of the week * (E.g. Sunday) is 1. */ public static int getFirstOfMonthDayOfWeek(GregorianCalendar aCalendar) { int currDom = aCalendar.get(Calendar.DAY_OF_MONTH); aCalendar.set(Calendar.DAY_OF_MONTH, 1); // 1 is Sunday (Hmmm... 0 is January, 1 is Sunday ??????) int firstDowInMonth = aCalendar.get(Calendar.DAY_OF_WEEK); aCalendar.set(Calendar.DAY_OF_MONTH, currDom); return firstDowInMonth; } }