Java Day of Week isWeekDay(final Date date)

Here you can find the source of isWeekDay(final Date date)

Description

Figure out whether a Date is a week day.

License

Apache License

Parameter

Parameter Description
date Date

Return

boolean

Declaration

public static boolean isWeekDay(final Date date) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;
import java.util.Date;

public class Main {
    /**//from   w  ww  . j av a  2 s. com
     * Figure out whether a Date is a week day.
     * @param date Date
     * @return boolean
     */
    public static boolean isWeekDay(final Date date) {
        if (null == date) {
            return false;
        }
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY
                || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
            return false;
        }
        return true;
    }
}

Related

  1. incWeek(java.util.Date date, int amount, Locale locale)
  2. isMatchWeek(Date date, int week)
  3. isOnWeekend(Date date)
  4. isSameWeekDates(Date date1, Date date2)
  5. isWeekday(Date startDate)
  6. isWeekEnd(Date date)
  7. isWeekend(Date date)
  8. isWeekend(Date date)
  9. isWeekend(Date date)