Here you can find the source of sameMonth(Calendar one, Calendar two)
Parameter | Description |
---|---|
one | The one calendar. |
two | The other calendar. |
public static boolean sameMonth(Calendar one, Calendar two)
//package com.java2s; //License from project: Apache License import java.util.Calendar; public class Main { /**//from w w w .ja v a 2s.c om * Returns <tt>true</tt> if the two given calendars are dated on the same year and month. * @param one The one calendar. * @param two The other calendar. * @return True if the two given calendars are dated on the same year and month. */ public static boolean sameMonth(Calendar one, Calendar two) { return one.get(Calendar.MONTH) == two.get(Calendar.MONTH) && sameYear(one, two); } /** * Returns <tt>true</tt> if the two given calendars are dated on the same year. * @param one The one calendar. * @param two The other calendar. * @return True if the two given calendars are dated on the same year. */ public static boolean sameYear(Calendar one, Calendar two) { return one.get(Calendar.YEAR) == two.get(Calendar.YEAR); } }