Java tutorial
import java.time.DayOfWeek; import java.time.LocalDate; import java.time.temporal.ChronoField; public class Main { public static void main(String[] argv) { System.out.println(isWeekend(LocalDate.now())); } /** * This method checks whether the given date object is representing a date at * the weekend (Saturday or Sunday) * * @param date * Date to check, cannot be null * @return TRUE is Saturday or Sunday */ public static boolean isWeekend(LocalDate date) { DayOfWeek dayOfWeek = DayOfWeek.of(date.get(ChronoField.DAY_OF_WEEK)); switch (dayOfWeek) { case SATURDAY: case SUNDAY: return true; default: return false; } } }