Here you can find the source of isSameDay(final Calendar calendar1, final Calendar calendar2)
Parameter | Description |
---|---|
calendar1 | the 1st calendar |
calendar2 | the 2nd calendar |
public static boolean isSameDay(final Calendar calendar1, final Calendar calendar2)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { /**// w w w. j av a 2 s. c om * Test if 2 calendar are in the same day * * @param calendar1 the 1st calendar * @param calendar2 the 2nd calendar * @return a boolean */ public static boolean isSameDay(final Calendar calendar1, final Calendar calendar2) { boolean res = false; if (calendar1.getTimeZone() == calendar2.getTimeZone() && calendar1.get(Calendar.DAY_OF_YEAR) == calendar2.get(Calendar.DAY_OF_YEAR) && calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR)) { res = true; } return res; } }