List of usage examples for java.util Calendar getActualMaximum
public int getActualMaximum(int field)
Calendar
. From source file:Main.java
public static int getDaysLeftInYear() { Calendar calendar = Calendar.getInstance(); return calendar.getActualMaximum(Calendar.DAY_OF_YEAR) - calendar.get(Calendar.DAY_OF_YEAR); }
From source file:Main.java
public static Date lastTimeOfMonth(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date);/*from w w w. ja va 2 s . c o m*/ cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.HOUR_OF_DAY, cal.getActualMaximum(Calendar.HOUR_OF_DAY)); cal.set(Calendar.MINUTE, cal.getActualMaximum(Calendar.MINUTE)); cal.set(Calendar.SECOND, cal.getActualMaximum(Calendar.SECOND)); cal.set(Calendar.MILLISECOND, cal.getActualMaximum(Calendar.MILLISECOND)); return cal.getTime(); }
From source file:Main.java
/** * Get current month end day/* ww w. j a va2 s .c om*/ * * @return */ public static int getCurrentMonthEndDay() { Calendar calendar = Calendar.getInstance(); return calendar.getActualMaximum(Calendar.DAY_OF_MONTH); }
From source file:Main.java
public static Date getLastDayOfYear() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DATE, calendar.getActualMaximum(Calendar.DATE)); return calendar.getTime(); }
From source file:Main.java
public static int getTheMonthDayCount(Date date) { Calendar c = Calendar.getInstance(); c.setTime(date);/*from w w w. jav a 2 s .co m*/ int lastDay = c.getActualMaximum(Calendar.DAY_OF_MONTH); return lastDay; }
From source file:Main.java
public static String getMonthLastDay() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); return dateFormat.format(calendar.getTime()); }
From source file:Main.java
public static Date endOfThisMonth() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DATE, calendar.getActualMaximum(Calendar.DATE)); calendar.set(Calendar.HOUR, calendar.getActualMaximum(Calendar.HOUR)); calendar.set(Calendar.MINUTE, calendar.getActualMaximum(Calendar.MINUTE)); calendar.set(Calendar.SECOND, calendar.getActualMaximum(Calendar.SECOND)); calendar.set(Calendar.MILLISECOND, calendar.getActualMaximum(Calendar.MILLISECOND)); return calendar.getTime(); }
From source file:Main.java
public static int getDayOfMaonth(int y, int m) { Calendar cal = Calendar.getInstance(); cal.set(y, m - 1, 1);/* ww w. j a v a 2 s . co m*/ int dateOfMonth = cal.getActualMaximum(Calendar.DATE); return dateOfMonth; }
From source file:Main.java
public static int getDayOfMonth(int y, int m) { Calendar cal = Calendar.getInstance(); cal.set(y, m - 1, 1);/*from ww w . jav a 2 s. c o m*/ int dateOfMonth = cal.getActualMaximum(Calendar.DATE); return dateOfMonth; }
From source file:Main.java
public static long getEndOfCurrentMonth() { Calendar calendar = getCurrentCalendar(); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); return calendar.getTimeInMillis(); }