TimeUtils { public static int month() { return Calendar.getInstance().get(Calendar.MONTH) + 1; } private  TimeUtils(); static String nowStr(); static String date2Str(Date date); static String date2Str(long date); static int month(); static Date yesterdayBegin(); static Date yesterdayEnd(); static Date pastWeekStart(); static Long howLongBeginThisMonth(); static Date beginThisMonth(); static Date lastMonthTodayInBegin(); static Date lastFewDaysInBegin(Integer days); static Date fewDaysAgoEnd(int index); static Date fewDaysAgoBegin(int index); static Date endMonth(int year, int month); static Date beginMonth(int year, int month); static Date zeroTimeZone(Date date); static String nowTimeWithZone();  }
@Test public void test() { int m = Integer.parseInt(new SimpleDateFormat("MM").format(new Date())); _log.debug("month:{}", m); assertEquals(m, TimeUtils.month()); }