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:in.suraj.timetableswipe.TYFragment.java
private void init() { rgroup = (RadioGroup) rootView.findViewById(R.id.rbgrp); rbMon = (RadioButton) rootView.findViewById(R.id.rbMon); rbTue = (RadioButton) rootView.findViewById(R.id.rbTue); rbWed = (RadioButton) rootView.findViewById(R.id.rbWed); rbThur = (RadioButton) rootView.findViewById(R.id.rbThur); rbFri = (RadioButton) rootView.findViewById(R.id.rbFri); tvLect1Name = (TextView) rootView.findViewById(R.id.tvLect1Name); tvLect1Prof = (TextView) rootView.findViewById(R.id.tvLect1Prof); tvLect2Name = (TextView) rootView.findViewById(R.id.tvLect2Name); tvLect2Prof = (TextView) rootView.findViewById(R.id.tvLect2Prof); tvLect3Name = (TextView) rootView.findViewById(R.id.tvLect3Name); tvLect3Prof = (TextView) rootView.findViewById(R.id.tvLect3Prof); tvLect4Name = (TextView) rootView.findViewById(R.id.tvLect4Name); tvLect4Prof = (TextView) rootView.findViewById(R.id.tvLect4Prof); tvLect5Name = (TextView) rootView.findViewById(R.id.tvLect5Name); tvLect5Prof = (TextView) rootView.findViewById(R.id.tvLect5Prof); Calendar c = Calendar.getInstance(); int dayOfWeek = c.get(Calendar.DAY_OF_WEEK); if (Calendar.MONDAY == dayOfWeek) { setUpMonday();//from w ww. j a v a 2s .com } else if (Calendar.TUESDAY == dayOfWeek) { setUpTuesday(); } else if (Calendar.WEDNESDAY == dayOfWeek) { setUpWednesday(); } else if (Calendar.THURSDAY == dayOfWeek) { setUpThursday(); } else if (Calendar.FRIDAY == dayOfWeek) { setUpFriday(); } else if (Calendar.SATURDAY == dayOfWeek) { } else if (Calendar.SUNDAY == dayOfWeek) { } }
From source file:in.suraj.timetableswipe.SYFragment.java
private void init() { rgroup = (RadioGroup) rootView.findViewById(R.id.rbgrp); rbMon = (RadioButton) rootView.findViewById(R.id.rbMon); rbTue = (RadioButton) rootView.findViewById(R.id.rbTue); rbWed = (RadioButton) rootView.findViewById(R.id.rbWed); rbThur = (RadioButton) rootView.findViewById(R.id.rbThur); rbFri = (RadioButton) rootView.findViewById(R.id.rbFri); tvLect1Name = (TextView) rootView.findViewById(R.id.tvLect1Name); tvLect1Prof = (TextView) rootView.findViewById(R.id.tvLect1Prof); tvLect2Name = (TextView) rootView.findViewById(R.id.tvLect2Name); tvLect2Prof = (TextView) rootView.findViewById(R.id.tvLect2Prof); tvLect3Name = (TextView) rootView.findViewById(R.id.tvLect3Name); tvLect3Prof = (TextView) rootView.findViewById(R.id.tvLect3Prof); tvLect4Name = (TextView) rootView.findViewById(R.id.tvLect4Name); tvLect4Prof = (TextView) rootView.findViewById(R.id.tvLect4Prof); tvLect5Name = (TextView) rootView.findViewById(R.id.tvLect5Name); tvLect5Prof = (TextView) rootView.findViewById(R.id.tvLect5Prof); Calendar c = Calendar.getInstance(); int dayOfWeek = c.get(Calendar.DAY_OF_WEEK); if (Calendar.MONDAY == dayOfWeek) { setUpMonday();/*from www. jav a2s.co m*/ } else if (Calendar.TUESDAY == dayOfWeek) { setUpTuesday(); } else if (Calendar.WEDNESDAY == dayOfWeek) { setUpWednesday(); } else if (Calendar.THURSDAY == dayOfWeek) { setUpThursday(); } else if (Calendar.FRIDAY == dayOfWeek) { setUpFriday(); } else if (Calendar.SATURDAY == dayOfWeek) { } else if (Calendar.SUNDAY == dayOfWeek) { } }
From source file:org.sipfoundry.sipxconfig.admin.CronScheduleTest.java
public void testGetCronStringWeekly() { CronSchedule schedule = new CronSchedule(); schedule.setMin(12);/*from w w w. j a v a 2 s . co m*/ schedule.setHrs(13); schedule.setDayOfWeek(Calendar.TUESDAY); schedule.setType(CronSchedule.Type.WEEKLY); assertEquals("0 12 13 ? * 3", schedule.getCronString()); }
From source file:com.ozpathway.sw.erms.webapp.action.schedule.ScheduleBean.java
public void addSampleEntries(ActionEvent event) { if (model == null) return;/*from www .ja v a 2 s . com*/ 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:org.structr.common.RecurringDateHelper.java
private static String getShortWeekday(final int wd) { switch (wd) { case Calendar.MONDAY: return ShortWeekday.Mo.name(); case Calendar.TUESDAY: return ShortWeekday.Di.name(); case Calendar.WEDNESDAY: return ShortWeekday.Mi.name(); case Calendar.THURSDAY: return ShortWeekday.Do.name(); case Calendar.FRIDAY: return ShortWeekday.Fr.name(); case Calendar.SATURDAY: return ShortWeekday.Sa.name(); case Calendar.SUNDAY: return ShortWeekday.So.name(); }/*from w w w . j av a2s . co m*/ return ""; }
From source file:org.jasig.schedassist.model.CommonDateOperations.java
/** * Helper method to calculate the first week's end date. * /* w ww. ja v a2 s.co m*/ * @param date * @return the number of days from date until the following Sunday */ public static int numberOfDaysUntilSunday(final Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); int result = 7; switch (dayOfWeek) { case Calendar.SUNDAY: result = 7; break; case Calendar.MONDAY: result = 6; break; case Calendar.TUESDAY: result = 5; break; case Calendar.WEDNESDAY: result = 4; break; case Calendar.THURSDAY: result = 3; break; case Calendar.FRIDAY: result = 2; break; case Calendar.SATURDAY: result = 1; break; } return result; }
From source file:org.kuali.kfs.module.endow.document.service.impl.FrequencyDatesServiceImpl.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 av a2 s .com * @return next processing date */ protected Calendar 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 calendar; }
From source file:com.clustercontrol.jobmanagement.factory.JobPlanSchedule.java
/** * ????Cron??//from www .ja v a 2 s. c o m * * @param cron */ private void createPlan(String cron) { /* * cron * */ // * 0 15 * * ? * 1500 // * 0 23 ? * 1 * 2300 // * */10 * * * ? * 10?? String[] planSplit = cron.split(" "); String aster = "*"; String question = "?"; String slash = "/"; if (!aster.equals(planSplit[0])) { secondType = 0; second = Integer.parseInt(planSplit[0]); } if (!aster.equals(planSplit[1])) { String[] slashSplit = planSplit[1].split(slash); int num = 0; for (String str : slashSplit) { m_log.trace("slashSplit[ " + num + " ] =" + str); num++; } //p?q???? if (slashSplit.length == 2) { minuteType = 3; minute = Integer.parseInt(slashSplit[0]); fromMinutes = Integer.parseInt(slashSplit[0]); everyMinutes = Integer.parseInt(slashSplit[1]); } else { minuteType = 0; minute = Integer.parseInt(planSplit[1]); m_log.debug("minuteType=" + minuteType); m_log.debug("minute=" + minute); } } if (!aster.equals(planSplit[2])) { hourType = 0; hour = Integer.parseInt(planSplit[2]); } if (question.equals(planSplit[3])) { dayType = 2; } else if (!aster.equals(planSplit[3])) { dayType = 0; day = Integer.parseInt(planSplit[3]); } if (!aster.equals(planSplit[4])) { monthType = 0; month = Integer.parseInt(planSplit[4]); } if (question.equals(planSplit[5])) { weekType = 2; } else if (!aster.equals(planSplit[5])) { weekType = 0; week = Integer.parseInt(planSplit[5]); } switch (week) { case 1: weekCalendar = Calendar.SUNDAY; break; case 2: weekCalendar = Calendar.MONDAY; break; case 3: weekCalendar = Calendar.TUESDAY; break; case 4: weekCalendar = Calendar.WEDNESDAY; break; case 5: weekCalendar = Calendar.THURSDAY; break; case 6: weekCalendar = Calendar.FRIDAY; break; case 7: weekCalendar = Calendar.SATURDAY; break; default: weekCalendar = Calendar.SUNDAY; } // weekType?0?????????? // ??????????*????0?? if (weekType == 0 && isFireDayOfWeek() == false) { nextFireDay(); if (hourType == 1) { hour = 0; } } }
From source file:com.pressurelabs.flowopensource.TheHubActivity.java
private void generateDrawerGreeting(NavigationView view) { View header = view.getHeaderView(0); TextView greeting = (TextView) header.findViewById(R.id.ndrawer_date_greeting); String[] array = this.getResources().getStringArray(R.array.drawer_greeting); switch (Calendar.getInstance().get(Calendar.DAY_OF_WEEK)) { case Calendar.MONDAY: greeting.setText(array[0]);//from w ww.j a va 2s.c o m break; case Calendar.TUESDAY: greeting.setText(array[1]); break; case Calendar.WEDNESDAY: greeting.setText(array[2]); break; case Calendar.THURSDAY: greeting.setText(array[3]); break; case Calendar.FRIDAY: greeting.setText(array[4]); break; case Calendar.SATURDAY: greeting.setText(array[5]); break; case Calendar.SUNDAY: greeting.setText(array[6]); break; default: greeting.setText(array[7]); break; } }
From source file:com.mb.framework.util.DateTimeUtil.java
/** * This method is used for getting day of week short description * /*from w ww.j a v a 2 s . co m*/ * @param dayOfWeek * @return */ public static String getDayOfWeekShortDesc(int dayOfWeek) { String dayOfWeekShortDesc; switch (dayOfWeek) { case Calendar.SUNDAY: { dayOfWeekShortDesc = DateTimeConstants.SHORT_SUNDAY; break; } case Calendar.MONDAY: { dayOfWeekShortDesc = DateTimeConstants.SHORT_MONDAY; break; } case Calendar.TUESDAY: { dayOfWeekShortDesc = DateTimeConstants.SHORT_TUESDAY; break; } case Calendar.WEDNESDAY: { dayOfWeekShortDesc = DateTimeConstants.SHORT_WEDNESDAY; break; } case Calendar.THURSDAY: { dayOfWeekShortDesc = DateTimeConstants.SHORT_THURSDAY; break; } case Calendar.FRIDAY: { dayOfWeekShortDesc = DateTimeConstants.SHORT_FRIDAY; break; } case Calendar.SATURDAY: { dayOfWeekShortDesc = DateTimeConstants.SHORT_SATURDAY; break; } default: { dayOfWeekShortDesc = ""; break; } } return dayOfWeekShortDesc; }