List of usage examples for java.util Calendar WEDNESDAY
int WEDNESDAY
To view the source code for java.util Calendar WEDNESDAY.
Click Source Link
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 w w.j a v a 2 s . co 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 . java2s . com */ 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 a 2s .c o m return ""; }
From source file:org.structr.common.RecurringDateHelper.java
private static int getDayOfWeek(final String shortWeekday) { if (shortWeekday != null && !shortWeekday.equals("")) try {// w ww .j a v a 2 s .co m 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: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 ww w . jav a2 s .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: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 .j a v a 2s . c o 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.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/*from w w w. j a v a 2 s . 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()); }
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 ww .j a va 2 s.co m return ""; }
From source file:org.jasig.schedassist.model.CommonDateOperations.java
/** * Helper method to calculate the first week's end date. * // w w w. j a va 2 s .com * @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.sipfoundry.sipxconfig.admin.CronScheduleTest.java
public void testSetScheduledDay() { CronSchedule schedule = new CronSchedule(); schedule.setScheduledDay(ScheduledDay.WEDNESDAY); assertEquals(Calendar.WEDNESDAY, schedule.getDayOfWeek()); }