Java Day of Week isWeekday(Date startDate)

Here you can find the source of isWeekday(Date startDate)

Description

decides if a day is Mon through Fri

License

Open Source License

Parameter

Parameter Description
startDate a parameter

Return

true if weekday, else false

Declaration

public static boolean isWeekday(Date startDate) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    /**// w ww . ja va 2  s .c  o  m
     * decides if a day is Mon through Fri
     * @param startDate
     * @return true if weekday, else false
     */
    public static boolean isWeekday(Date startDate) {
        GregorianCalendar cal = new GregorianCalendar();
        cal.setTime(startDate);
        if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)
            return false;
        return true;

    }
}

Related

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