List of usage examples for java.util Calendar getActualMaximum
public int getActualMaximum(int field)
Calendar
. From source file:Main.java
public static int getNumberOfWeeksInCurrentMonth() { Calendar calendar = getCalendarWithTime(getStartOfCurrentMonth()); return calendar.getActualMaximum(Calendar.WEEK_OF_MONTH); }
From source file:Main.java
public static int getNumberOfDaysInMonth(Date someDayInMonth) { Calendar monthCal = Calendar.getInstance(); monthCal.setTime(someDayInMonth);// w w w. j av a 2 s . c om return monthCal.getActualMaximum(Calendar.DAY_OF_MONTH); }
From source file:Main.java
public static int getDayNumOfMonth(int y, int m) { Calendar calendar = Calendar.getInstance(); calendar.set(y, m - 1, 1);//from w ww .j a v a 2 s .c o m int dateNumber = calendar.getActualMaximum(Calendar.DATE); return dateNumber; }
From source file:Main.java
public static int getTotalWeeks(Calendar calendar) { if (null == calendar) return 0; int maxWeeks = calendar.getActualMaximum(Calendar.WEEK_OF_MONTH); return maxWeeks; }
From source file:Main.java
public static void moveToCalendarMinuteTerminal(Calendar cal) { moveToCalendarSecond(cal, cal.getActualMaximum(Calendar.SECOND)); moveToCalendarSecondTerminal(cal);/*from w w w. j a va 2s . c om*/ }
From source file:Main.java
public static void moveToCalendarSecondTerminal(Calendar cal) { moveToCalendarMillisecond(cal, cal.getActualMaximum(Calendar.MILLISECOND)); }
From source file:Util.java
public static Date getLastMonthLastDate() { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.MONTH, -1); int max = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); calendar.set(Calendar.DAY_OF_MONTH, max); return calendar.getTime(); }
From source file:Main.java
public static Calendar getCalendarSetToLastDayOfPreviousMonth(Calendar currentMonth) { currentMonth.add(Calendar.MONTH, -1); currentMonth.set(Calendar.DAY_OF_MONTH, currentMonth.getActualMaximum(Calendar.DAY_OF_MONTH)); return currentMonth; }
From source file:Main.java
public static void moveToCalendarHourTerminal(Calendar cal) { // 2011/11/17 11:59:59.999 moveToCalendarMinute(cal, cal.getActualMaximum(Calendar.MINUTE)); moveToCalendarMinuteTerminal(cal);//from w w w .j ava 2s. com }
From source file:Main.java
public static int getNextMonthDays(Date date) { Calendar c = Calendar.getInstance(); c.setTime(date);/*w w w .j a v a2s . c o m*/ c.add(Calendar.MONTH, 1); return c.getActualMaximum(Calendar.DAY_OF_MONTH); }