Here you can find the source of isEndOfWeek()
public static boolean isEndOfWeek()
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static final String DF_YMD = "yyyy-MM-dd"; public static boolean isEndOfWeek() { return getWeekNumByDate(getCurrentDate_String()) == 0; }//from w w w .j a v a 2s .com public static int getWeekNumByDate(String date) { SimpleDateFormat format = new SimpleDateFormat(DF_YMD); try { Date d = format.parse(date); Calendar cal = Calendar.getInstance(); cal.setTime(d); int num = cal.get(Calendar.DAY_OF_WEEK) - 1; return num; } catch (ParseException e) { e.printStackTrace(); } return 0; } public static String getCurrentDate_String() { return dateToString(now(), DF_YMD); } public static String dateToString(Date date, String format) { if (date == null) { return ""; } synchronized (date) { SimpleDateFormat df = new SimpleDateFormat(format); return df.format(date); } } public static String dateToString(Date date) { return dateToString(date, DF_YMD); } public static Date now() { return new Date(); } }