List of utility methods to do Weekend
boolean | IsWeekEnd(GregorianCalendar aInCal) Is Week End String lDayName = aInCal.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT, Locale.getDefault()); if (Objects.equals(lDayName, new String("Sun")) || (Objects.equals(lDayName, new String("Sat")))) { return true; return false; |
boolean | isWeekend(String date) is Weekend Calendar cal = Calendar.getInstance(); Date d = strToDtSimpleFormat(date); cal.setTime(d); int day = cal.get(Calendar.DAY_OF_WEEK); if (day == Calendar.SUNDAY || day == Calendar.SATURDAY) { return true; return false; ... |
boolean | isWeekend(String date) is Weekend SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Date time = null; try { time = df.parse(date); } catch (ParseException e) { e.printStackTrace(); Calendar cal = Calendar.getInstance(); ... |
boolean | isWeekend(String date) is Weekend if (getCurWeekDayByStr(date) == 1 || getCurWeekDayByStr(date) == 7) { return true; return false; |
boolean | isWeekend(String dateStr) is Weekend Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { cal.setTime(sdf.parse(dateStr)); int n = cal.get(Calendar.DAY_OF_WEEK); return n == Calendar.SATURDAY || n == Calendar.SUNDAY; } catch (ParseException e) { e.printStackTrace(); ... |
boolean | isWeekend(String datestr) is Weekend if (datestr == null || "".equals(datestr.trim())) { return false; SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd"); try { Date date = myFormatter.parse(datestr); Calendar calendar = new GregorianCalendar(); calendar.setTime(date); ... |
boolean | isWeekends(String date, String pattern) is Weekends GregorianCalendar gc = new GregorianCalendar(); gc.setTime(getDate(date, pattern)); int ret = gc.get(Calendar.DAY_OF_WEEK) - 1; if (ret == 0 || ret == 6) { return true; return false; |