is Same Month between two Calendar - Android java.util

Android examples for java.util:Month

Description

is Same Month between two Calendar

Demo Code


//package com.java2s;

import java.util.Calendar;

public class Main {
    /**//from w  w w.j av a2s. c om
     *
     * @param c1
     * @param c2
     * @return
     */
    public static boolean isSameMonth(Calendar c1, Calendar c2) {
        return !(c1 == null || c2 == null)
                && (c1.get(Calendar.ERA) == c2.get(Calendar.ERA)
                        && (c1.get(Calendar.YEAR) == c2.get(Calendar.YEAR)) && (c1
                        .get(Calendar.MONTH) == c2.get(Calendar.MONTH)));
    }
}

Related Tutorials