Here you can find the source of isWeekend(String date)
public static boolean isWeekend(String date)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; public class Main { public static boolean isWeekend(String date) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Date time = null;/*from w ww . j a v a 2 s . c om*/ try { time = df.parse(date); } catch (ParseException e) { e.printStackTrace(); } Calendar cal = Calendar.getInstance(); cal.setTime(time); int day = cal.get(Calendar.DAY_OF_WEEK); return day == Calendar.SATURDAY || day == Calendar.SUNDAY; } }