is More Days between two Calendar - Android java.util

Android examples for java.util:Day

Description

is More Days between two Calendar

Demo Code


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

public class Main {
    public static boolean isMoreDays(Calendar startTime, Calendar endTime) {
        return !isSameDay(startTime, endTime);
    }/*from  w  w w  .  ja  va2  s . co  m*/

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

    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
            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