Java Code Examples for java.util.Calendar.FRIDAY

The following are Jave code examples for showing how to use FRIDAY of the java.util.Calendar class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: LightSIP   File: SIPDate.java   View Source Code Vote up 8 votes
/**
 * Set the wkday member
 * @param w String to set
 * @throws IllegalArgumentException if w is not a valid day.
 */
public void setWkday(String w) throws IllegalArgumentException {
    sipWkDay = w;
    if (sipWkDay.compareToIgnoreCase(MON) == 0) {
        wkday = Calendar.MONDAY;
    } else if (sipWkDay.compareToIgnoreCase(TUE) == 0) {
        wkday = Calendar.TUESDAY;
    } else if (sipWkDay.compareToIgnoreCase(WED) == 0) {
        wkday = Calendar.WEDNESDAY;
    } else if (sipWkDay.compareToIgnoreCase(THU) == 0) {
        wkday = Calendar.THURSDAY;
    } else if (sipWkDay.compareToIgnoreCase(FRI) == 0) {
        wkday = Calendar.FRIDAY;
    } else if (sipWkDay.compareToIgnoreCase(SAT) == 0) {
        wkday = Calendar.SATURDAY;
    } else if (sipWkDay.compareToIgnoreCase(SUN) == 0) {
        wkday = Calendar.SUNDAY;
    } else {
        throw new IllegalArgumentException("Illegal Week day :" + w);
    }
}
 
Example 2
Project: NotifyTools   File: ChineseCalendar.java   View Source Code Vote up 7 votes
public String WeekDayStr()
{
    cld.setTime(_date);
        switch (cld.get(Calendar.DAY_OF_WEEK))
        {
            case Calendar.SUNDAY:
                return "星期日";
            case Calendar.MONDAY:
                return "星期一";
            case Calendar.TUESDAY:
                return "星期二";
            case Calendar.WEDNESDAY:
                return "星期三";
            case Calendar.THURSDAY:
                return "星期四";
            case Calendar.FRIDAY:
                return "星期五";
            default:
                return "星期六";
        }

}
 
Example 3
Project: unitimes   File: MeetingCountingDuration.java   View Source Code Vote up 7 votes
protected int nbrMeetings(DatePattern datePattern, int dayCode) {
	if (datePattern == null) return 0;
	Calendar cal = Calendar.getInstance(Locale.US);
	cal.setTime(datePattern.getStartDate()); cal.setLenient(true);
       String pattern = datePattern.getPattern();
       int ret = 0;
       for (int idx = 0; idx < pattern.length(); idx++) {
       	if (pattern.charAt(idx) == '1') {
       		boolean offered = false;
       		switch (cal.get(Calendar.DAY_OF_WEEK)) {
       			case Calendar.MONDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_MON]) != 0); break;
       			case Calendar.TUESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_TUE]) != 0); break;
       			case Calendar.WEDNESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_WED]) != 0); break;
       			case Calendar.THURSDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_THU]) != 0); break;
       			case Calendar.FRIDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_FRI]) != 0); break;
       			case Calendar.SATURDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SAT]) != 0); break;
       			case Calendar.SUNDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SUN]) != 0); break;
       		}
       		if (offered) ret++;
       	}
       	cal.add(Calendar.DAY_OF_YEAR, 1);
       }
       return ret;
}
 
Example 4
Project: AmenEye   File: DateUtil.java   View Source Code Vote up 7 votes
public static String getWeek(Calendar calendar) {
    String[] week = AmenEyeApplication.getContext().getResources().getStringArray(R.array.week_array);
    int day = calendar.get(Calendar.DAY_OF_WEEK);
    switch (day) {
        case Calendar.MONDAY:
            return week[0];
        case Calendar.TUESDAY:
            return week[1];
        case Calendar.WEDNESDAY:
            return week[2];
        case Calendar.THURSDAY:
            return week[3];
        case Calendar.FRIDAY:
            return week[4];
        case Calendar.SATURDAY:
            return week[5];
        case Calendar.SUNDAY:
            return week[6];
        default:
            return null;
    }
}
 
Example 5
Project: unitimes   File: PersonalizedExamReportAction.java   View Source Code Vote up 7 votes
public int getDaysCode(Set meetings) {
    int daysCode = 0;
    for (Iterator i=meetings.iterator();i.hasNext();) {
        Meeting meeting = (Meeting)i.next();
        Calendar date = Calendar.getInstance(Locale.US);
        date.setTime(meeting.getMeetingDate());
        switch (date.get(Calendar.DAY_OF_WEEK)) {
        case Calendar.MONDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_MON]; break;
        case Calendar.TUESDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_TUE]; break;
        case Calendar.WEDNESDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_WED]; break;
        case Calendar.THURSDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_THU]; break;
        case Calendar.FRIDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_FRI]; break;
        case Calendar.SATURDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_SAT]; break;
        case Calendar.SUNDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_SUN]; break;
        }
    }
    return daysCode;
}
 
Example 6
Project: sample-bluetooth-le-gattserver   File: TimeProfile.java   View Source Code Vote up 7 votes
/**
 * Convert a {@link Calendar} weekday value to the corresponding
 * Bluetooth weekday code.
 */
private static byte getDayOfWeekCode(int dayOfWeek) {
    switch (dayOfWeek) {
        case Calendar.MONDAY:
            return DAY_MONDAY;
        case Calendar.TUESDAY:
            return DAY_TUESDAY;
        case Calendar.WEDNESDAY:
            return DAY_WEDNESDAY;
        case Calendar.THURSDAY:
            return DAY_THURSDAY;
        case Calendar.FRIDAY:
            return DAY_FRIDAY;
        case Calendar.SATURDAY:
            return DAY_SATURDAY;
        case Calendar.SUNDAY:
            return DAY_SUNDAY;
        default:
            return DAY_UNKNOWN;
    }
}
 
Example 7
Project: wisebite_android   File: GetRestaurantActivity.java   View Source Code Vote up 7 votes
/**
 * Get text view regarding a date
 * @param date date 
 * @return text view
 */
private int getTextView(Date date) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(date);
    switch (calendar.get(Calendar.DAY_OF_WEEK)) {
        case Calendar.MONDAY:
            return R.id.monday_open_time;
        case Calendar.TUESDAY:
            return R.id.tuesday_open_time;
        case Calendar.WEDNESDAY:
            return R.id.wednesday_open_time;
        case Calendar.THURSDAY:
            return R.id.thursday_open_time;
        case Calendar.FRIDAY:
            return R.id.friday_open_time;
        case Calendar.SATURDAY:
            return R.id.saturday_open_time;
        case Calendar.SUNDAY:
            return R.id.sunday_open_time;
    }
    return 0;
}
 
Example 8
Project: resourceprovider   File: MainPresenter.java   View Source Code Vote up 7 votes
void present() {
    mainView.setFormattedText(resourceProvider.getStrings().getOneArgFormattedString(FORMAT_ARG));

    Calendar today = Calendar.getInstance();
    if (today.get(Calendar.DAY_OF_MONTH) > MONTH_HALFWAY_POINT) {
        mainView.setDateString(resourceProvider.getStrings().getSecondHalfOfMonth());
    } else {
        mainView.setDateString(resourceProvider.getStrings().getFirstHalfOfMonth());
    }

    int dayOfWeek = today.get(Calendar.DAY_OF_WEEK);
    int daysUntilFriday = Calendar.FRIDAY - dayOfWeek;
    if (daysUntilFriday >= 0) {
        mainView.setPluralsString(resourceProvider.getStrings().getDaysUntilFridayQuantityString(daysUntilFriday, daysUntilFriday));
    } else {
        mainView.setPluralsString(resourceProvider.getStrings().getSaturday());
    }

    mainView.setDrawable(resourceProvider.getDrawables().getIcnNavDino());
    mainView.setDimenText("The Test Dimen is " + resourceProvider.getDimens().getTestDimenPixelSize() + " in pixels");
    mainView.setIntegerText("The Test Integer is " + resourceProvider.getIntegers().getTestInteger());
    mainView.setColorViewBackgroundColor(resourceProvider.getColors().getBabyBlue());
}
 
Example 9
Project: wisebite_android   File: Utils.java   View Source Code Vote up 7 votes
public static int parseViewIdToDayOfWeek(Integer viewId) {
    switch (viewId) {
        case R.id.monday_date_picker:
            return Calendar.MONDAY;
        case R.id.tuesday_date_picker:
            return Calendar.TUESDAY;
        case R.id.wednesday_date_picker:
            return Calendar.WEDNESDAY;
        case R.id.thursday_date_picker:
            return Calendar.THURSDAY;
        case R.id.friday_date_picker:
            return Calendar.FRIDAY;
        case R.id.saturday_date_picker:
            return Calendar.SATURDAY;
        case R.id.sunday_date_picker:
            return Calendar.SUNDAY;
        default:
            return 0;
    }
}
 
Example 10
Project: unitimes   File: ClassesAction.java   View Source Code Vote up 7 votes
public int getDaysCode(Set meetings) {
    int daysCode = 0;
    for (Iterator i=meetings.iterator();i.hasNext();) {
        Meeting meeting = (Meeting)i.next();
        Calendar date = Calendar.getInstance(Locale.US);
        date.setTime(meeting.getMeetingDate());
        switch (date.get(Calendar.DAY_OF_WEEK)) {
        case Calendar.MONDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_MON]; break;
        case Calendar.TUESDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_TUE]; break;
        case Calendar.WEDNESDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_WED]; break;
        case Calendar.THURSDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_THU]; break;
        case Calendar.FRIDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_FRI]; break;
        case Calendar.SATURDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_SAT]; break;
        case Calendar.SUNDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_SUN]; break;
        }
    }
    return daysCode;
}
 
Example 11
Project: Remindy   File: Weekdays.java   View Source Code Vote up 7 votes
public void setDay(int calendarDay, boolean active) {
    switch (calendarDay) {
        case Calendar.MONDAY:
            value.set(0, active);
            break;
        case Calendar.TUESDAY:
            value.set(1, active);
            break;
        case Calendar.WEDNESDAY:
            value.set(2, active);
            break;
        case Calendar.THURSDAY:
            value.set(3, active);
            break;
        case Calendar.FRIDAY:
            value.set(4, active);
            break;
        case Calendar.SATURDAY:
            value.set(5, active);
            break;
        case Calendar.SUNDAY:
            value.set(6, active);
            break;
    }
}
 
Example 12
Project: ChronoBike   File: OpenCalendar.java   View Source Code Vote up 7 votes
private int getDayOfWeeekId(String csDayValue)
{
	csDayValue = csDayValue.toUpperCase();
	if(csDayValue.startsWith("MON"))
		return Calendar.MONDAY;
	else if(csDayValue.startsWith("TUE"))
		return Calendar.TUESDAY;
	else if(csDayValue.startsWith("WED"))
		return Calendar.WEDNESDAY;
	else if(csDayValue.startsWith("THU"))
		return Calendar.THURSDAY;
	else if(csDayValue.startsWith("FRI"))
		return Calendar.FRIDAY;
	else if(csDayValue.startsWith("SAT"))
		return Calendar.SATURDAY;
	return Calendar.SUNDAY;
}
 
Example 13
Project: unitimes   File: PdfLegacyExamReport.java   View Source Code Vote up 7 votes
public int getDaysCode(Set meetings) {
    int daysCode = 0;
    for (Iterator i=meetings.iterator();i.hasNext();) {
        Meeting meeting = (Meeting)i.next();
        Calendar date = Calendar.getInstance(Locale.US);
        date.setTime(meeting.getMeetingDate());
        switch (date.get(Calendar.DAY_OF_WEEK)) {
        case Calendar.MONDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_MON]; break;
        case Calendar.TUESDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_TUE]; break;
        case Calendar.WEDNESDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_WED]; break;
        case Calendar.THURSDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_THU]; break;
        case Calendar.FRIDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_FRI]; break;
        case Calendar.SATURDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_SAT]; break;
        case Calendar.SUNDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_SUN]; break;
        }
    }
    return daysCode;
}
 
Example 14
Project: SmartMath   File: MFPDateTime.java   View Source Code Vote up 6 votes
public static DataClass getDayOfWeek(LinkedList<DataClass> listParams) throws JFCALCExpErrException {
    if (listParams.size() != 1)   {
        throw new JFCALCExpErrException(ERRORTYPES.ERROR_INCORRECT_NUM_OF_PARAMETER);
    }
    DataClass datumTS = new DataClass();
    datumTS.copyTypeValueDeep(listParams.removeLast());
    datumTS.changeDataType(DATATYPES.DATUM_INTEGER);
    long lTS = datumTS.getDataValue().longValue();
    Calendar cal = Calendar.getInstance();
    cal.setTimeInMillis(lTS);
    int nReturn = cal.get(Calendar.DAY_OF_WEEK);
    int nDayOfWeek = 0;
    switch (nReturn) {
        case (Calendar.SUNDAY): {
            nDayOfWeek = 0;
            break;
        } case (Calendar.MONDAY): {
            nDayOfWeek = 1;
            break;
        } case (Calendar.TUESDAY): {
            nDayOfWeek = 2;
            break;
        } case (Calendar.WEDNESDAY): {
            nDayOfWeek = 3;
            break;
        } case (Calendar.THURSDAY): {
            nDayOfWeek = 4;
            break;
        } case (Calendar.FRIDAY): {
            nDayOfWeek = 5;
            break;
        } case (Calendar.SATURDAY): {
            nDayOfWeek = 6;
            break;
        }
    }
    return new DataClass(DATATYPES.DATUM_INTEGER, new MFPNumeric(nDayOfWeek));
}
 
Example 15
Project: unitimes   File: MinutesPerWeek.java   View Source Code Vote up 6 votes
/**
 * Return all dates marked yellow in the given date pattern that are matching the selected day code (days of week)
 */
@Override
public List<Date> getDates(int minsPerWeek, DatePattern datePattern, int dayCode, int minutesPerMeeting) {
	List<Date> ret = new ArrayList<Date>();
	if (datePattern == null) return ret;
	Calendar cal = Calendar.getInstance(Locale.US);
	cal.setTime(datePattern.getStartDate()); cal.setLenient(true);
       EventDateMapping.Class2EventDateMap class2eventDates = EventDateMapping.getMapping(datePattern.getSession().getUniqueId());
       String pattern = datePattern.getPattern();
       for (int idx = 0; idx < pattern.length(); idx++) {
       	if (pattern.charAt(idx) == '1') {
       		boolean offered = false;
       		switch (cal.get(Calendar.DAY_OF_WEEK)) {
       			case Calendar.MONDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_MON]) != 0); break;
       			case Calendar.TUESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_TUE]) != 0); break;
       			case Calendar.WEDNESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_WED]) != 0); break;
       			case Calendar.THURSDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_THU]) != 0); break;
       			case Calendar.FRIDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_FRI]) != 0); break;
       			case Calendar.SATURDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SAT]) != 0); break;
       			case Calendar.SUNDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SUN]) != 0); break;
       		}
       		if (offered) ret.add(class2eventDates.getEventDate(cal.getTime()));
       	}
       	cal.add(Calendar.DAY_OF_YEAR, 1);
       }
	return ret;
}
 
Example 16
Project: Expert-Android-Programming   File: PlaceDetailActivity.java   View Source Code Vote up 6 votes
private void setTimings(List<RestaurantTiming> timings) {

        for (int i = 0; i < timings.size(); i++) {
            switch (AppUtils.getDay(timings.get(i).getDay())) {

                case Calendar.MONDAY:
                    timingMonday.setText(timings.get(i).getTiming());
                    break;
                case Calendar.TUESDAY:
                    timingTuesday.setText(timings.get(i).getTiming());
                    break;
                case Calendar.WEDNESDAY:
                    timingWednesday.setText(timings.get(i).getTiming());
                    break;
                case Calendar.THURSDAY:
                    timingThursday.setText(timings.get(i).getTiming());
                    break;
                case Calendar.FRIDAY:
                    timingFriday.setText(timings.get(i).getTiming());
                    break;
                case Calendar.SATURDAY:
                    timingSaturday.setText(timings.get(i).getTiming());
                    break;
                case Calendar.SUNDAY:
                    timingSunday.setText(timings.get(i).getTiming());
                    break;
            }
        }
        setToday();
    }
 
Example 17
Project: unitimes   File: MeetingCountingDuration.java   View Source Code Vote up 6 votes
@Override
public List<Date> getDates(int minutes, DatePattern datePattern, int dayCode, int minutesPerMeeting) {
	List<Date> ret = new ArrayList<Date>();
	if (datePattern == null) return ret;
	Calendar cal = Calendar.getInstance(Locale.US);
	cal.setTime(datePattern.getStartDate()); cal.setLenient(true);
       EventDateMapping.Class2EventDateMap class2eventDates = EventDateMapping.getMapping(datePattern.getSession().getUniqueId());
       String pattern = datePattern.getPattern();
       Integer max = getMaxMeetings(minutes, minutesPerMeeting);
       for (int idx = 0; idx < pattern.length(); idx++) {
       	if (pattern.charAt(idx) == '1') {
       		boolean offered = false;
       		switch (cal.get(Calendar.DAY_OF_WEEK)) {
       			case Calendar.MONDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_MON]) != 0); break;
       			case Calendar.TUESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_TUE]) != 0); break;
       			case Calendar.WEDNESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_WED]) != 0); break;
       			case Calendar.THURSDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_THU]) != 0); break;
       			case Calendar.FRIDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_FRI]) != 0); break;
       			case Calendar.SATURDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SAT]) != 0); break;
       			case Calendar.SUNDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SUN]) != 0); break;
       		}
       		if (offered) ret.add(class2eventDates.getEventDate(cal.getTime()));
       	}
       	cal.add(Calendar.DAY_OF_YEAR, 1);
       	if (max != null && ret.size() >= max) break;
       }
	return ret;
}
 
Example 18
Project: hive-udf-backports   File: GenericUDFNextDay.java   View Source Code Vote up 6 votes
protected int getIntDayOfWeek(String dayOfWeek) throws UDFArgumentException {
  if (dayOfWeek == null) {
    return -1;
  }
  if (MON.matches(dayOfWeek)) {
    return Calendar.MONDAY;
  }
  if (TUE.matches(dayOfWeek)) {
    return Calendar.TUESDAY;
  }
  if (WED.matches(dayOfWeek)) {
    return Calendar.WEDNESDAY;
  }
  if (THU.matches(dayOfWeek)) {
    return Calendar.THURSDAY;
  }
  if (FRI.matches(dayOfWeek)) {
    return Calendar.FRIDAY;
  }
  if (SAT.matches(dayOfWeek)) {
    return Calendar.SATURDAY;
  }
  if (SUN.matches(dayOfWeek)) {
    return Calendar.SUNDAY;
  }
  return -1;
}
 
Example 19
Project: workdays   File: DateUtils.java   View Source Code Vote up 6 votes
public static int parseWeekday(String s) {
    if(s == null) return -1;
    switch(s.toLowerCase()) {
        case "monday": return Calendar.MONDAY;
        case "tuesday": return Calendar.TUESDAY;
        case "wednesday": return Calendar.WEDNESDAY;
        case "thursday": return Calendar.THURSDAY;
        case "friday": return Calendar.FRIDAY;
        case "saturday": return Calendar.SATURDAY;
        case "sunday": return Calendar.SUNDAY;
        default: return -1;
    }
}
 
Example 20
Project: routineKeen   File: HabitTrackerFullTest.java   View Source Code Vote up 5 votes
@Test
public void testHabitSchedule() {

    // Get current day of the week in string form
    String today;
    int day = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
    switch (day) {
        case Calendar.SUNDAY:   today = "Sun";  break;
        case Calendar.MONDAY:   today = "Mon";  break;
        case Calendar.TUESDAY:  today = "Tue";  break;
        case Calendar.WEDNESDAY:today = "Wed";  break;
        case Calendar.THURSDAY: today = "Thu";  break;
        case Calendar.FRIDAY:   today = "Fri";  break;
        case Calendar.SATURDAY: today = "Sat";  break;
        default:                today = null;   break;
    }

    login();

    // add 2 habits
    solo.assertCurrentActivity("Wrong Activity", UserMenu.class);
    solo.clickOnText("View Habit List");
    clearHabitList();

    addTestHabit(TEST_HABIT_NAME, TEST_HABIT_REASON);
    addTestHabit(TEST_HABIT_NAME2, TEST_HABIT_REASON);
    addTestHabit(TEST_HABIT_NAME3, TEST_HABIT_REASON);

    solo.assertCurrentActivity("Wrong Activity", HabitListActivity.class);
    solo.clickOnText(TEST_HABIT_NAME);
    disableAllDays();
    solo.clickOnButton("Save");

    solo.assertCurrentActivity("Wrong Activity", HabitListActivity.class);
    solo.clickOnText(TEST_HABIT_NAME2);
    disableAllDays();
    solo.clickOnText(today);
    solo.clickOnButton("Save");

    solo.goBack();
    solo.assertCurrentActivity("Wrong Activity", UserMenu.class);
    solo.clickOnText("View Habit Schedule");

    try { TimeUnit.SECONDS.sleep(2); } catch (InterruptedException e) { Log.d(LOG, "wait interrupted"); }
    // check that there are 2 habits in today's schedule
    assertEquals(((ListView)solo.getView("habitSchedule_listView")).getAdapter().getCount(), 2);
}