Author: fdesbois Date: 2009-08-19 10:06:23 +0200 (Wed, 19 Aug 2009) New Revision: 25 Modified: trunk/chorem-commons/src/main/java/org/chorem/utils/DateUtils.java trunk/chorem-commons/src/main/java/org/chorem/utils/PeriodDates.java Log: Add getMonth method Modified: trunk/chorem-commons/src/main/java/org/chorem/utils/DateUtils.java =================================================================== --- trunk/chorem-commons/src/main/java/org/chorem/utils/DateUtils.java 2009-08-17 13:11:56 UTC (rev 24) +++ trunk/chorem-commons/src/main/java/org/chorem/utils/DateUtils.java 2009-08-19 08:06:23 UTC (rev 25) @@ -100,4 +100,10 @@ public static boolean currentPeriod(Date beforeDate, Date afterDate) { return between(new Date(), beforeDate, afterDate); } + + public static int getMonth(Date date) { + Calendar calendar = new GregorianCalendar(); + calendar.setTime(date); + return calendar.get(Calendar.MONTH); + } } Modified: trunk/chorem-commons/src/main/java/org/chorem/utils/PeriodDates.java =================================================================== --- trunk/chorem-commons/src/main/java/org/chorem/utils/PeriodDates.java 2009-08-17 13:11:56 UTC (rev 24) +++ trunk/chorem-commons/src/main/java/org/chorem/utils/PeriodDates.java 2009-08-19 08:06:23 UTC (rev 25) @@ -112,6 +112,10 @@ return this.fromDate; } + public int getFromMonth() { + return this.fromCalendar.get(Calendar.MONTH); + } + public void setThruDate(Date thruDate) { this.thruDate = thruDate; this.thruCalendar.setTime(thruDate);