Java Day End isSameDay(final Calendar calendar1, final Calendar calendar2)

Here you can find the source of isSameDay(final Calendar calendar1, final Calendar calendar2)

Description

Test if 2 calendar are in the same day

License

Apache License

Parameter

Parameter Description
calendar1 the 1st calendar
calendar2 the 2nd calendar

Return

a boolean

Declaration

public static boolean isSameDay(final Calendar calendar1, final Calendar calendar2) 

Method Source Code

//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;
    }
}

Related

  1. isInRange(Date myDate, Date dateStart, Date dateEnd)
  2. isInWorkDay(Calendar start)
  3. isMoreThenMonth(Date startDate, Date enDate)
  4. isNowBetween(Date start, Date end)
  5. isSameDay(Calendar cal1, Calendar cal2)
  6. isTodayWithinPeriod(Date periodStart, Date periodEnd)
  7. isValidSendDate(Date sendDate)
  8. isWorkingDay(final Calendar calendar, final Long[] holidays)
  9. postponeWorkingDay(final Calendar calendar, final int measureUnit, final int amount, final Long[] holidays)