compare Week Day And Month Day - Android java.util

Android examples for java.util:Week

Description

compare Week Day And Month Day

Demo Code

import java.util.Calendar;

public class Main{

    public static boolean compareWeekDayAndMonthDay(int weekDay,
            int monthDay) {
        boolean match = false;
        Calendar calendar = Calendar.getInstance();

        int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1;
        if (dayOfWeek == 0) {
            dayOfWeek = 7;/*  ww  w  . j a  va 2s .co  m*/
        }
        int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
        if (weekDay == dayOfWeek || dayOfMonth == monthDay) {
            match = true;
        } else if (weekDay == 0 && monthDay == 0) {
            match = true;
        }
        return match;
    }

}

Related Tutorials