is Same Day for two Calendar - Android java.util

Android examples for java.util:Day

Description

is Same Day for two Calendar

Demo Code


//package com.java2s;
import java.util.Calendar;

public class Main {
    public static boolean isSameDay(Calendar calendarDate1,
            Calendar calendarDate2) {
        if (calendarDate1.get(Calendar.YEAR) == calendarDate2
                .get(Calendar.YEAR)
                && calendarDate1.get(Calendar.MONTH) == calendarDate2
                        .get(Calendar.MONTH)
                && calendarDate1.get(Calendar.DAY_OF_MONTH) == calendarDate2
                        .get(Calendar.DAY_OF_MONTH))
            return true;
        else/*w  ww.  ja va  2  s .  c o m*/
            return false;
    }

    public static boolean isSameDay(int[] date1, int[] date2) {
        if (date1[0] == date2[0] && date1[1] == date2[1]
                && date1[2] == date2[2])
            return true;
        else
            return false;
    }
}

Related Tutorials