List of usage examples for java.util Calendar MONTH
int MONTH
To view the source code for java.util Calendar MONTH.
Click Source Link
get
and set
indicating the month. From source file:Main.java
public static Calendar addMonthToDate(Calendar data, int quantidade) { Calendar dataRetorno = (Calendar) data.clone(); dataRetorno.add(Calendar.MONTH, quantidade); return dataRetorno; }
From source file:Main.java
public static Calendar GetThisYearLeftRange(Calendar today) { Calendar calendar = (Calendar) today.clone(); calendar.set(Calendar.MONTH, 0); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.add(Calendar.MINUTE, 0); return calendar; }
From source file:Main.java
public static int getMonth(Date date) { return getCalendar(date).get(Calendar.MONTH); }
From source file:Main.java
public static Calendar GetLastYearRightRange(Calendar today) { Calendar calendar = (Calendar) today.clone(); calendar.set(Calendar.MONTH, 0); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.add(Calendar.MINUTE, 0); return calendar; }
From source file:Main.java
public static int getMonthDayNumber(int offset) { Calendar calendar = Calendar.getInstance(); if (offset != 0) calendar.add(Calendar.MONTH, offset); return calendar.getActualMaximum(Calendar.DAY_OF_MONTH); }
From source file:Main.java
public static int getMonth(Date date) { Calendar c = Calendar.getInstance(); c.setTime(date);//from ww w. j a v a2 s . c o m return c.get(Calendar.MONTH) + 1; }
From source file:Main.java
public static int getNextMonth() { current.add(Calendar.MONTH, 1); return current.get(Calendar.MONTH); }
From source file:Main.java
public static String getNow() { final Calendar calendar = Calendar.getInstance(); return calendar.get(Calendar.YEAR) + "/" + calendar.get(Calendar.MONTH) + 1 + "/" + calendar.get(Calendar.DAY_OF_MONTH) + "/" + " " + calendar.get(Calendar.HOUR_OF_DAY) + ":" + calendar.get(Calendar.MINUTE) + ":" + calendar.get(Calendar.SECOND); }
From source file:Main.java
public static int getCurrentMonth() { Calendar calendar = Calendar.getInstance(); return calendar.get(Calendar.MONTH) + 1; }
From source file:Main.java
public static boolean isSameDay(Calendar cal1, Calendar cal2) { return cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH) && cal1.get(Calendar.DAY_OF_MONTH) == cal2.get(Calendar.DAY_OF_MONTH); }