List of usage examples for java.util Calendar TUESDAY
int TUESDAY
To view the source code for java.util Calendar TUESDAY.
Click Source Link
From source file:calendar.services.transformers.EntryToWeekRowTransformer.java
private BigDecimal setEntryToDayInWeekRow(Entry entry, WeekRow weekRow) { Date date = entry.getDate();//from w w w.j a v a2 s . com Calendar cal = Calendar.getInstance(); cal.setTime(date); Integer dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); BigDecimal entryHours = entry.getHours(); switch (cal.get(Calendar.DAY_OF_WEEK)) { case Calendar.SUNDAY: weekRow.setDay7Total(weekRow.getDay7Total().add(entryHours)); weekRow.setDay7(entry.getDate()); break; case Calendar.MONDAY: weekRow.setDay1Total(weekRow.getDay1Total().add(entryHours)); weekRow.setDay1(entry.getDate()); break; case Calendar.TUESDAY: weekRow.setDay2Total(weekRow.getDay2Total().add(entryHours)); weekRow.setDay2(entry.getDate()); break; case Calendar.WEDNESDAY: weekRow.setDay3Total(weekRow.getDay3Total().add(entryHours)); weekRow.setDay3(entry.getDate()); break; case Calendar.THURSDAY: weekRow.setDay4Total(weekRow.getDay4Total().add(entryHours)); weekRow.setDay4(entry.getDate()); break; case Calendar.FRIDAY: weekRow.setDay5Total(weekRow.getDay5Total().add(entryHours)); weekRow.setDay5(entry.getDate()); break; case Calendar.SATURDAY: weekRow.setDay6Total(weekRow.getDay6Total().add(entryHours)); weekRow.setDay6(entry.getDate()); break; } return entryHours; }
From source file:org.apache.myfaces.examples.schedule.ScheduleExampleHandler.java
public void addSampleEntries(ActionEvent event) { if (model == null) return;// ww w. ja v a 2s .c om Calendar calendar = GregorianCalendar.getInstance(); calendar.setTime(model.getSelectedDate()); calendar.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY); calendar.set(Calendar.HOUR_OF_DAY, 14); DefaultScheduleEntry entry1 = new DefaultScheduleEntry(); // every entry in a schedule must have a unique id entry1.setId(RandomStringUtils.randomNumeric(32)); entry1.setStartTime(calendar.getTime()); calendar.add(Calendar.MINUTE, 45); entry1.setEndTime(calendar.getTime()); entry1.setTitle("Test MyFaces schedule component"); entry1.setSubtitle("my office"); entry1.setDescription("We need to get this thing out of the sandbox ASAP"); model.addEntry(entry1); DefaultScheduleEntry entry2 = new DefaultScheduleEntry(); entry2.setId(RandomStringUtils.randomNumeric(32)); // entry2 overlaps entry1 calendar.add(Calendar.MINUTE, -20); entry2.setStartTime(calendar.getTime()); calendar.add(Calendar.HOUR, 2); entry2.setEndTime(calendar.getTime()); entry2.setTitle("Show schedule component to boss"); entry2.setSubtitle("my office"); entry2.setDescription("Convince him to get time to thoroughly test it"); model.addEntry(entry2); DefaultScheduleEntry entry3 = new DefaultScheduleEntry(); entry3.setId(RandomStringUtils.randomNumeric(32)); calendar.add(Calendar.DATE, 1); calendar.set(Calendar.HOUR_OF_DAY, 9); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); entry3.setStartTime(calendar.getTime()); calendar.set(Calendar.HOUR_OF_DAY, 17); entry3.setEndTime(calendar.getTime()); entry3.setTitle("Thoroughly test schedule component"); model.addEntry(entry3); DefaultScheduleEntry entry4 = new DefaultScheduleEntry(); entry4.setId(RandomStringUtils.randomNumeric(32)); calendar.add(Calendar.MONTH, -1); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); calendar.set(Calendar.HOUR_OF_DAY, 11); entry4.setStartTime(calendar.getTime()); calendar.set(Calendar.HOUR_OF_DAY, 14); entry4.setEndTime(calendar.getTime()); entry4.setTitle("Long lunch"); model.addEntry(entry4); DefaultScheduleEntry entry5 = new DefaultScheduleEntry(); entry5.setId(RandomStringUtils.randomNumeric(32)); calendar.add(Calendar.MONTH, 2); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.HOUR_OF_DAY, 1); entry5.setStartTime(calendar.getTime()); calendar.set(Calendar.HOUR_OF_DAY, 5); entry5.setEndTime(calendar.getTime()); entry5.setTitle("Fishing trip"); model.addEntry(entry5); //Let's add a zero length entry... DefaultScheduleEntry entry6 = new DefaultScheduleEntry(); calendar.setTime(model.getSelectedDate()); calendar.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); calendar.set(Calendar.HOUR_OF_DAY, 16); entry6.setId(RandomStringUtils.randomNumeric(32)); entry6.setStartTime(calendar.getTime()); entry6.setEndTime(calendar.getTime()); entry6.setTitle("Zero length entry"); entry6.setDescription("Is only rendered when the 'renderZeroLengthEntries' attribute is 'true'"); model.addEntry(entry6); //And also an allday event DefaultScheduleEntry entry7 = new DefaultScheduleEntry(); entry7.setId(RandomStringUtils.randomNumeric(32)); entry7.setTitle("All day event"); entry7.setSubtitle("This event renders as an all-day event"); entry7.setAllDay(true); model.addEntry(entry7); model.refresh(); }
From source file:com.karthikb351.vitinfo2.fragment.schedule.ScheduleFragment.java
private int getEquivalentDay(int day) { switch (day) { case Calendar.SUNDAY: day = 6;//from w w w . jav a 2 s. c o m break; case Calendar.MONDAY: case Calendar.TUESDAY: case Calendar.WEDNESDAY: case Calendar.THURSDAY: case Calendar.FRIDAY: case Calendar.SATURDAY: day -= 2; break; default: day = 0; } return day; }
From source file:org.ohmage.reminders.types.time.TimeTrigDesc.java
private void initialize(boolean repeatStatus) { mIsRandomized = false;// ww w .j a v a2s . c o m mIsRangeEnabled = false; mRepeatList.put(getDayOfWeekString(Calendar.SUNDAY), repeatStatus); mRepeatList.put(getDayOfWeekString(Calendar.MONDAY), repeatStatus); mRepeatList.put(getDayOfWeekString(Calendar.TUESDAY), repeatStatus); mRepeatList.put(getDayOfWeekString(Calendar.WEDNESDAY), repeatStatus); mRepeatList.put(getDayOfWeekString(Calendar.THURSDAY), repeatStatus); mRepeatList.put(getDayOfWeekString(Calendar.FRIDAY), repeatStatus); mRepeatList.put(getDayOfWeekString(Calendar.SATURDAY), repeatStatus); }
From source file:org.kuali.student.r2.core.scheduling.util.SchedulingServiceUtil.java
public static List<Integer> weekdaysString2WeekdaysList(String weekdaysString) { List<Integer> result = new ArrayList<Integer>(); if (StringUtils.isNotBlank(weekdaysString)) { checkStringForDayCode(SchedulingServiceConstants.MONDAY_TIMESLOT_DAY_CODE, Calendar.MONDAY, result, weekdaysString);/*from w w w.j a va2 s. co m*/ checkStringForDayCode(SchedulingServiceConstants.TUESDAY_TIMESLOT_DAY_CODE, Calendar.TUESDAY, result, weekdaysString); checkStringForDayCode(SchedulingServiceConstants.WEDNESDAY_TIMESLOT_DAY_CODE, Calendar.WEDNESDAY, result, weekdaysString); checkStringForDayCode(SchedulingServiceConstants.THURSDAY_TIMESLOT_DAY_CODE, Calendar.THURSDAY, result, weekdaysString); checkStringForDayCode(SchedulingServiceConstants.FRIDAY_TIMESLOT_DAY_CODE, Calendar.FRIDAY, result, weekdaysString); checkStringForDayCode(SchedulingServiceConstants.SATURDAY_TIMESLOT_DAY_CODE, Calendar.SATURDAY, result, weekdaysString); checkStringForDayCode(SchedulingServiceConstants.SUNDAY_TIMESLOT_DAY_CODE, Calendar.SUNDAY, result, weekdaysString); } return result; }
From source file:org.sakaiproject.util.CalendarUtil.java
void initDates() { Calendar calendarSunday = Calendar.getInstance(); Calendar calendarMonday = Calendar.getInstance(); Calendar calendarTuesday = Calendar.getInstance(); Calendar calendarWednesday = Calendar.getInstance(); Calendar calendarThursday = Calendar.getInstance(); Calendar calendarFriday = Calendar.getInstance(); Calendar calendarSaturday = Calendar.getInstance(); calendarSunday.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); calendarMonday.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); calendarTuesday.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY); calendarWednesday.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY); calendarThursday.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY); calendarFriday.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); calendarSaturday.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); dateSunday = calendarSunday.getTime(); dateMonday = calendarMonday.getTime(); dateTuesday = calendarTuesday.getTime(); dateWednesday = calendarWednesday.getTime(); dateThursday = calendarThursday.getTime(); dateFriday = calendarFriday.getTime(); dateSaturday = calendarSaturday.getTime(); Calendar calendarJanuary = Calendar.getInstance(); Calendar calendarFebruary = Calendar.getInstance(); Calendar calendarMarch = Calendar.getInstance(); Calendar calendarApril = Calendar.getInstance(); Calendar calendarMay = Calendar.getInstance(); Calendar calendarJune = Calendar.getInstance(); Calendar calendarJuly = Calendar.getInstance(); Calendar calendarAugust = Calendar.getInstance(); Calendar calendarSeptember = Calendar.getInstance(); Calendar calendarOctober = Calendar.getInstance(); Calendar calendarNovember = Calendar.getInstance(); Calendar calendarDecember = Calendar.getInstance(); calendarJanuary.set(Calendar.MONTH, Calendar.JANUARY); calendarFebruary.set(Calendar.MONTH, Calendar.FEBRUARY); calendarMarch.set(Calendar.MONTH, Calendar.MARCH); calendarApril.set(Calendar.MONTH, Calendar.APRIL); calendarMay.set(Calendar.MONTH, Calendar.MAY); calendarJune.set(Calendar.MONTH, Calendar.JUNE); calendarJuly.set(Calendar.MONTH, Calendar.JULY); calendarAugust.set(Calendar.MONTH, Calendar.AUGUST); calendarSeptember.set(Calendar.MONTH, Calendar.SEPTEMBER); calendarOctober.set(Calendar.MONTH, Calendar.OCTOBER); calendarNovember.set(Calendar.MONTH, Calendar.NOVEMBER); calendarDecember.set(Calendar.MONTH, Calendar.DECEMBER); dateJanuary = calendarJanuary.getTime(); dateFebruary = calendarFebruary.getTime(); dateMarch = calendarMarch.getTime(); dateApril = calendarApril.getTime(); dateMay = calendarMay.getTime();//from w ww. j a v a 2s . c o m dateJune = calendarJune.getTime(); dateJuly = calendarJuly.getTime(); dateAugust = calendarAugust.getTime(); dateSeptember = calendarSeptember.getTime(); dateOctober = calendarOctober.getTime(); dateNovember = calendarNovember.getTime(); dateDecember = calendarDecember.getTime(); }
From source file:com.clican.pluto.common.calendar.BusinessCalendar.java
/** * Initial method /*from w w w. j ava 2 s . c o m*/ */ public void init() { days = new BusinessDay[8]; days[Calendar.SUNDAY] = parseDay(sunday); days[Calendar.MONDAY] = parseDay(monday); days[Calendar.TUESDAY] = parseDay(tuesday); days[Calendar.WEDNESDAY] = parseDay(wednesday); days[Calendar.THURSDAY] = parseDay(thursday); days[Calendar.FRIDAY] = parseDay(friday); days[Calendar.SATURDAY] = parseDay(saturday); holidays = new Holiday[holidayList.size()]; for (int i = 0; i < holidayList.size(); i++) { holidays[i] = parseHoliday(holidayList.get(i)); } }
From source file:util.MyUtils.java
public static String getWeekDay(String dob) { // sun - 1, mon (2), tue(3), wed(4), thu (5), fri(6) int day = new Integer(dob.substring(8, dob.length())).intValue(); Calendar cal = Calendar.getInstance(); cal.set(new Integer(getYear(dob)).intValue(), new Integer(getMonthNum(dob)).intValue(), day); int weekDay = cal.get(Calendar.DAY_OF_WEEK); switch (weekDay) { case Calendar.SUNDAY: return "Sunday"; 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"; }/*from w w w.j a v a2s . c om*/ return ""; }
From source file:org.structr.common.RecurringDateHelper.java
private static int getDayOfWeek(final String shortWeekday) { if (shortWeekday != null && !shortWeekday.equals("")) try {//from w ww .j av a2 s. com ShortWeekday wd = ShortWeekday.valueOf(shortWeekday); switch (wd) { case Mo: return Calendar.MONDAY; case Di: return Calendar.TUESDAY; case Mi: return Calendar.WEDNESDAY; case Do: return Calendar.THURSDAY; case Fr: return Calendar.FRIDAY; case Sa: return Calendar.SATURDAY; case So: return Calendar.SUNDAY; } } catch (Throwable t) { logger.log(Level.WARNING, "Unable to parse day of week for string {0}", shortWeekday); } return 0; }
From source file:org.kuali.kfs.module.endow.businessobject.lookup.CalculateProcessDateUsingFrequencyCodeService.java
/** * Method to calculate the next processing week date based on the frequency type * adds the appropriate number of days to the current date * @param dayOfWeek/*w w w .j a v a 2s . co m*/ * @return next processing date */ protected Date calculateNextWeeklyDate(String dayOfWeekFromFrequencyCode, Date currentDate) { Calendar calendar = Calendar.getInstance(); calendar.setTime(currentDate); int daysToAdd = 0; int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); // today's day of the week int maximumDaysInWeek = calendar.getActualMaximum(Calendar.DAY_OF_WEEK); if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.MONDAY)) { if (dayOfWeek < Calendar.MONDAY) daysToAdd = Calendar.MONDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.MONDAY; } else if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.TUESDAY)) { if (dayOfWeek < Calendar.TUESDAY) daysToAdd = Calendar.TUESDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.TUESDAY; } else if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.WEDNESDAY)) { if (dayOfWeek < Calendar.WEDNESDAY) daysToAdd = Calendar.WEDNESDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.WEDNESDAY; } else if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.THURSDAY)) { if (dayOfWeek < Calendar.THURSDAY) daysToAdd = Calendar.THURSDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.THURSDAY; } else if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.FRIDAY)) { if (dayOfWeek < Calendar.FRIDAY) daysToAdd = Calendar.FRIDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.FRIDAY; } calendar.add(Calendar.DAY_OF_MONTH, daysToAdd); return new java.sql.Date(calendar.getTimeInMillis()); }