Java Day of Week isWork(String weekday, Date date)

Here you can find the source of isWork(String weekday, Date date)

Description

is Work

License

Apache License

Declaration

public static boolean isWork(String weekday, Date date) 

Method Source Code

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

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

public class Main {
    public static boolean isWork(String weekday, Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);//  w  w w .  ja  v  a2 s .  c  o m
        int week = (calendar.get(Calendar.DAY_OF_WEEK) - 2 + 7) % 7;
        return "1".equals(weekday.substring(week, week + 1));
    }
}

Related

  1. isWeekend(Date date)
  2. isWeekend(Date dt)
  3. isWeekEnd(Date in)
  4. isWeekend(final Date date)
  5. isWeekendDay(final DayOfWeek nDayOfWeek)
  6. javaCalendarToNewTimeApi(int dayOfWeek)
  7. mergeDayIntoDate(Date baseDate, int dayOfWeek)
  8. nextDayOfWeek(Date fromDate, int dow)
  9. nextWeek(Date date)