@Test public void testGsCurrentMonth(){ assertEquals(true, DateUtil.isCurrentMonth(new Date())); assertEquals(false, DateUtil.isCurrentMonth(new Date(1322197921282L))); }
public static boolean isCurrentMonth(Date date){ if(date != null){ Calendar dest = Calendar.getInstance(); dest.setTime(date); Calendar now = Calendar.getInstance(); return now.get(Calendar.YEAR) == dest.get(Calendar.YEAR) && now.get(Calendar.MONTH) == dest.get(Calendar.MONTH); } return false; }
DateUtil { public static boolean isCurrentMonth(Date date){ if(date != null){ Calendar dest = Calendar.getInstance(); dest.setTime(date); Calendar now = Calendar.getInstance(); return now.get(Calendar.YEAR) == dest.get(Calendar.YEAR) && now.get(Calendar.MONTH) == dest.get(Calendar.MONTH); } return false; } }
DateUtil { public static boolean isCurrentMonth(Date date){ if(date != null){ Calendar dest = Calendar.getInstance(); dest.setTime(date); Calendar now = Calendar.getInstance(); return now.get(Calendar.YEAR) == dest.get(Calendar.YEAR) && now.get(Calendar.MONTH) == dest.get(Calendar.MONTH); } return false; }  }
DateUtil { public static boolean isCurrentMonth(Date date){ if(date != null){ Calendar dest = Calendar.getInstance(); dest.setTime(date); Calendar now = Calendar.getInstance(); return now.get(Calendar.YEAR) == dest.get(Calendar.YEAR) && now.get(Calendar.MONTH) == dest.get(Calendar.MONTH); } return false; }  static String getYearMonth(Date date); static String formateYearMonthDay(Date date); static Date parseYearMonthDay(String timeStr, Date defaultValue); static String formateDateTime(Date date); static Date parseDateTime(String timeStr, Date defaultValue); static final int getCurrentHour(); static final int getLastHour(); static final int getNextHour(); static Date getFirstDayOfCurMonth(); static Date getFirstDayInMonth(Date date); static Date getFirstDayInMonth(int month); static boolean isCurrentMonth(Date date); }
DateUtil { public static boolean isCurrentMonth(Date date){ if(date != null){ Calendar dest = Calendar.getInstance(); dest.setTime(date); Calendar now = Calendar.getInstance(); return now.get(Calendar.YEAR) == dest.get(Calendar.YEAR) && now.get(Calendar.MONTH) == dest.get(Calendar.MONTH); } return false; }  static String getYearMonth(Date date); static String formateYearMonthDay(Date date); static Date parseYearMonthDay(String timeStr, Date defaultValue); static String formateDateTime(Date date); static Date parseDateTime(String timeStr, Date defaultValue); static final int getCurrentHour(); static final int getLastHour(); static final int getNextHour(); static Date getFirstDayOfCurMonth(); static Date getFirstDayInMonth(Date date); static Date getFirstDayInMonth(int month); static boolean isCurrentMonth(Date date);  }