public static boolean isSameMonth ( final Date date1 , final Date date2 ) { final Calendar cal1 = Calendar . getInstance ( ) ; cal1 . setTime ( date1 ) ; final Calendar cal2 = Calendar . getInstance ( ) ; cal2 . setTime ( date2 ) ; return cal1 . get ( Calendar . ERA ) == cal2 . get ( Calendar . ERA ) && cal1 . get ( Calendar . YEAR ) == cal2 . get ( Calendar . YEAR ) && cal1 . get ( Calendar . MONTH ) == cal2 . get ( Calendar . MONTH ) ; }
Determines whether the specified date1 is the same month with the specified date2 .