Here you can find the source of getFirstMonthWeek(Date month)
Parameter | Description |
---|---|
month | initial month |
public static Date getFirstMonthWeek(Date month)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { /** The Constant MILLISECOND. */ public final static long MILLISECOND = 1l; /**//from ww w .java 2 s .c o m * Gets the first week which ends in specified month. * * @param month initial month * @return first day of first week of the month */ public static Date getFirstMonthWeek(Date month) { // Get last day of month Calendar firstWeek = Calendar.getInstance(); firstWeek.setTime(month); firstWeek.set(Calendar.DATE, 1); firstWeek.set(Calendar.HOUR, 0); firstWeek.set(Calendar.MINUTE, 0); firstWeek.set(Calendar.SECOND, 0); firstWeek.set(Calendar.MILLISECOND, 0); firstWeek.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); return firstWeek.getTime(); } }