Here you can find the source of isWeekend(String date)
public static boolean isWeekend(String date)
//package com.java2s; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; public class Main { public static final String dateFormat = "yyyy-MM-dd"; public static boolean isWeekend(String date) { Calendar cal = Calendar.getInstance(); Date d = strToDtSimpleFormat(date); cal.setTime(d);//w ww . ja v a 2 s . co m int day = cal.get(Calendar.DAY_OF_WEEK); if (day == Calendar.SUNDAY || day == Calendar.SATURDAY) { return true; } return false; } public static final Date strToDtSimpleFormat(String strDate) { if (strDate == null) { return null; } try { return getFormat(dateFormat).parse(strDate); } catch (Exception e) { } return null; } public static final DateFormat getFormat(String format) { return new SimpleDateFormat(format); } }