is Weekend, Saturday or Sunday - Android java.util

Android examples for java.util:Week

Description

is Weekend, Saturday or Sunday

Demo Code

import android.annotation.SuppressLint;
import android.text.format.DateUtils;
import android.text.format.Time;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

public class Main{

    /**//from w  w  w .j a  v a 2s . c  o  m
     * return date is Saturday or Sunday
     * @param date
     * @return
     */
    public static boolean isWeekend(Date date) {
        Time time = new Time();
        time.set(date.getTime());
        return (time.weekDay == Time.SATURDAY || time.weekDay == Time.SUNDAY);
    }

}

Related Tutorials