List of usage examples for java.util Calendar SATURDAY
int SATURDAY
To view the source code for java.util Calendar SATURDAY.
Click Source Link
From source file:com.codetroopers.betterpickers.calendardatepicker.CalendarDatePickerDialogFragment.java
public CalendarDatePickerDialogFragment setFirstDayOfWeek(int startOfWeek) { if (startOfWeek < Calendar.SUNDAY || startOfWeek > Calendar.SATURDAY) { throw new IllegalArgumentException("Value must be between Calendar.SUNDAY and Calendar.SATURDAY"); }/*w w w .j a va 2 s.c om*/ mWeekStart = startOfWeek; if (mDayPickerView != null) { mDayPickerView.onChange(); } return this; }
From source file:com.espertech.esper.regression.pattern.TestCronParameter.java
private int getLastWeekDayOfMonth(Integer day, int year) { int computeDay = (day == null) ? getLastDayOfMonth(year) : day; setTime(year);//ww w . j a v a 2 s . c o m if (!checkDayValidInMonth(computeDay, calendar.get(Calendar.MONTH), calendar.get(Calendar.YEAR))) { throw new IllegalArgumentException("Invalid day for " + calendar.get(Calendar.MONTH)); } calendar.set(Calendar.DAY_OF_MONTH, computeDay); int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); if ((dayOfWeek >= Calendar.MONDAY) && (dayOfWeek <= Calendar.FRIDAY)) { return computeDay; } if (dayOfWeek == Calendar.SATURDAY) { if (computeDay == 1) { calendar.add(Calendar.DAY_OF_MONTH, +2); } else { calendar.add(Calendar.DAY_OF_MONTH, -1); } } if (dayOfWeek == Calendar.SUNDAY) { if ((computeDay == 28) || (computeDay == 29) || (computeDay == 30) || (computeDay == 31)) { calendar.add(Calendar.DAY_OF_MONTH, -2); } else { calendar.add(Calendar.DAY_OF_MONTH, +2); } } return calendar.get(Calendar.DAY_OF_MONTH); }
From source file:de.ribeiro.android.gso.dataclasses.Pager.java
private String ResolveWeekDay(int value) { switch (value) { case Calendar.MONDAY: return "Montag"; case Calendar.TUESDAY: return "Dienstag"; case Calendar.WEDNESDAY: return "Mittwoch"; case Calendar.THURSDAY: return "Donnerstag"; case Calendar.FRIDAY: return "Freitag"; case Calendar.SATURDAY: return "Samstag"; case Calendar.SUNDAY: return "Sonntag"; default:// w w w.j av a2 s . c o m return String.valueOf(value); } }
From source file:org.pentaho.di.trans.steps.script.ScriptAddedFunctions.java
public static Object isWorkingDay(ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, Object FunctionContext) { if (ArgList.length == 1) { try {/*from ww w . j a va2 s .co m*/ if (isNull(ArgList[0])) { return null; } else if (isUndefined(ArgList[0])) { return undefinedValue; } else { java.util.Date dIn = (java.util.Date) ArgList[0]; Calendar startDate = Calendar.getInstance(); startDate.setTime(dIn); if (startDate.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && startDate.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) { return Boolean.TRUE; } return Boolean.FALSE; } } catch (Exception e) { return null; } } else { throw new RuntimeException("The function call isWorkingDay requires 1 argument."); } }
From source file:org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl.java
@Override public Date firstMissingWorklogsDate(final String selectedUser) throws GenericEntityException { Calendar scannedDate = Calendar.getInstance(); // one week// w w w. j a v a2s . c o m scannedDate.set(Calendar.DAY_OF_YEAR, scannedDate.get(Calendar.DAY_OF_YEAR) - DateTimeConverterUtil.DAYS_PER_WEEK); for (int i = 0; i < DateTimeConverterUtil.DAYS_PER_WEEK; i++) { // convert date to String Date scanedDateDate = scannedDate.getTime(); String scanedDateString = DateTimeConverterUtil.dateToString(scanedDateDate); // check excludse - pass if (excludeDatesSet.contains(scanedDateString)) { scannedDate.set(Calendar.DAY_OF_YEAR, scannedDate.get(Calendar.DAY_OF_YEAR) + 1); continue; } // check includes - not check weekend // check weekend - pass if (!includeDatesSet.contains(scanedDateString) && ((scannedDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) || (scannedDate.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY))) { scannedDate.set(Calendar.DAY_OF_YEAR, scannedDate.get(Calendar.DAY_OF_YEAR) + 1); continue; } // check worklog. if no worklog set result else ++ scanedDate boolean isDateContainsWorklog = isContainsWorklog(scanedDateDate); if (!isDateContainsWorklog) { return scanedDateDate; } else { scannedDate.set(Calendar.DAY_OF_YEAR, scannedDate.get(Calendar.DAY_OF_YEAR) + 1); } } // if we find everything all right then return with the current date return scannedDate.getTime(); }
From source file:Time.java
/** * Get default locale name of this day ("Monday", "Tuesday", etc. * // ww w . j a va 2 s.c o m * @return Name of day. */ public String getDayName() { switch (getDayOfWeek()) { case Calendar.MONDAY: return "Monday"; case Calendar.TUESDAY: return "Tuesday"; case Calendar.WEDNESDAY: return "Wednesday"; case Calendar.THURSDAY: return "Thursday"; case Calendar.FRIDAY: return "Friday"; case Calendar.SATURDAY: return "Saturday"; case Calendar.SUNDAY: return "Sunday"; } // This will never happen return null; }
From source file:com.akretion.kettle.steps.terminatooor.ScriptValuesAddedFunctions.java
public static Object isWorkingDay(ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, Object FunctionContext) { if (ArgList.length == 1) { try {// w w w. j a v a2s . c o m if (isNull(ArgList[0])) return null; else if (isUndefined(ArgList[0])) return undefinedValue; else { java.util.Date dIn = (java.util.Date) ArgList[0]; Calendar startDate = Calendar.getInstance(); startDate.setTime(dIn); if (startDate.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && startDate.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) return Boolean.TRUE; return Boolean.FALSE; } } catch (Exception e) { return null; } } else { throw new RuntimeException("The function call isWorkingDay requires 1 argument."); } }
From source file:org.sakaiproject.tool.section.jsf.backingbean.AddSectionsBean.java
public String getSaturday() { return daysOfWeek[Calendar.SATURDAY]; }
From source file:nu.mine.kino.projects.utils.ProjectUtils.java
/** * y?j`FbN/*from www. java2 s . c o m*/ * * @param holidays * @param targetDate * @return */ public static boolean isHoliday(Holiday[] holidays, Date targetDate) { if (holidays != null) {// for (Holiday holiday : holidays) { if (holiday.getDate().getTime() == targetDate.getTime()) { return true; } } } Calendar calendar = Calendar.getInstance(); calendar.setTime(targetDate); switch (calendar.get(Calendar.DAY_OF_WEEK)) { case Calendar.SATURDAY: case Calendar.SUNDAY: return true; default: return false; } }
From source file:com.aurel.track.linkType.MsProjectLinkTypeBL.java
/** * Returns number of saturdays from interval. Start date included always, endDate only if includeLastDay == true! * @param startDateParam/*from ww w . j ava 2 s . c om*/ * @param endDateParam * @param includeLastDay * @return */ public static Integer getNumberOfSaturdaysFromInterval(Date startDateParam, Date endDateParam, boolean includeLastDay) { Date realEndDate = endDateParam; if (includeLastDay) { Calendar cal = Calendar.getInstance(); cal.setTime(realEndDate); cal.add(Calendar.DAY_OF_YEAR, 1); realEndDate = cal.getTime(); } Calendar calendar = Calendar.getInstance(); calendar.setTime(startDateParam); int numOfSaturdays = 0; while (!calendar.getTime().after(realEndDate)) { if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) { numOfSaturdays++; } calendar.add(Calendar.DAY_OF_MONTH, 1); } return numOfSaturdays; }