Java Day of Week isWeekend(Date date)

Here you can find the source of isWeekend(Date date)

Description

is Weekend

License

Open Source License

Declaration

public static boolean isWeekend(Date date) 

Method Source Code

//package com.java2s;

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

public class Main {
    public static boolean isWeekend(Date date) {
        Calendar c = Calendar.getInstance();
        if (date != null)
            c.setTime(date);//w  ww .ja  v a 2s . co m
        int weekDay = c.get(7);
        return ((weekDay == 1) || (weekDay == 7));
    }

    public static boolean isWeekend() {
        return isWeekend(null);
    }
}

Related

  1. isOnWeekend(Date date)
  2. isSameWeekDates(Date date1, Date date2)
  3. isWeekday(Date startDate)
  4. isWeekDay(final Date date)
  5. isWeekEnd(Date date)
  6. isWeekend(Date date)
  7. isWeekend(Date date)
  8. isWeekend(Date date)
  9. isWeekend(Date date)