Example usage for java.util Calendar SATURDAY

List of usage examples for java.util Calendar SATURDAY

Introduction

In this page you can find the example usage for java.util Calendar SATURDAY.

Prototype

int SATURDAY

To view the source code for java.util Calendar SATURDAY.

Click Source Link

Document

Value of the #DAY_OF_WEEK field indicating Saturday.

Usage

From source file:org.osframework.contract.date.fincal.holiday.producer.SingleFinancialCalendarProducer.java

private void addWeekends(int year, List<Holiday> holidays) {
    c.clear();/* w w  w .  j  a va 2  s  . co m*/
    c.set(year, Calendar.JANUARY, 1);
    while (c.get(Calendar.YEAR) == year) {
        if (Calendar.SATURDAY == c.get(Calendar.DAY_OF_WEEK)
                || Calendar.SUNDAY == c.get(Calendar.DAY_OF_WEEK)) {
            holidays.add(new Holiday(calendar, c.getTime(), WEEKEND_HOLIDAY_DEFINITION));
        }
        c.add(Calendar.DAY_OF_MONTH, 1);
    }
}

From source file:org.silverpeas.calendar.CalendarViewContext.java

private void setReferenceDay(final Date date, int offset) {

    // Reference date
    Calendar cal = DateUtil.convert(date, locale);
    final Date referenceDate;
    if (!withWeekend && (viewType.equals(CalendarViewType.WEEKLY) || viewType.equals(CalendarViewType.DAILY))) {
        switch (cal.get(Calendar.DAY_OF_WEEK)) {
        case Calendar.SATURDAY:
            if (Calendar.SATURDAY == DateUtil.getFirstDayOfWeek(locale)) {
                referenceDate = DateUtils.addDays(date, (offset >= 0 ? 2 : -1));
            } else {
                referenceDate = DateUtils.addDays(date, (offset > 0 ? 2 : -1));
            }//  www . j  a va 2  s.com
            break;
        case Calendar.SUNDAY:
            if (Calendar.SUNDAY == DateUtil.getFirstDayOfWeek(locale)) {
                referenceDate = DateUtils.addDays(date, (offset >= 0 ? 1 : -2));
            } else {
                referenceDate = DateUtils.addDays(date, (offset > 0 ? 1 : -2));
            }
            break;
        default:
            referenceDate = date;
        }
    } else {
        referenceDate = date;
    }
    this.referenceDay = new CalendarDay(referenceDate, locale);

    // Period
    referencePeriod = CalendarPeriod.from(Period.from(referenceDate, viewType.getPeriodeType(), locale),
            locale);
}

From source file:com.clican.pluto.common.calendar.BusinessCalendar.java

/**
 * Initial method /*  w  w w .j  av a2s  .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: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 . ja v a  2 s .c om*/
    dateJune = calendarJune.getTime();
    dateJuly = calendarJuly.getTime();
    dateAugust = calendarAugust.getTime();
    dateSeptember = calendarSeptember.getTime();
    dateOctober = calendarOctober.getTime();
    dateNovember = calendarNovember.getTime();
    dateDecember = calendarDecember.getTime();

}

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  2  s . com
    return "";
}

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 v a  2  s .com
        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:com.shalzz.attendance.adapter.TimeTablePagerAdapter.java

public void updateDates() {
    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(mContext);
    boolean show = sharedPref.getBoolean(mContext.getString(R.string.pref_key_show_weekends), true);
    int day_offset = 0;
    Calendar calendar = Calendar.getInstance();
    for (int i = 0; i < getCount(); i++) {
        calendar.setTime(mDate);//from w w w  . java 2 s. c om
        calendar.add(Calendar.DATE, -15 + i);
        if (!show) {
            calendar.add(Calendar.DATE, day_offset);
            if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {
                calendar.add(Calendar.DATE, 1);
                ++day_offset;
            }
            if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
                calendar.add(Calendar.DATE, 1);
                ++day_offset;
            }
        }
        Date date = calendar.getTime();
        dates.put(i, date);
        positions.put(date, i);
    }
}

From source file:paarmann.physikprofil.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);

    initTabs();//w  w w . j  a v a2  s. c  o  m

    isPaused = false;

    findViewById(R.id.progressBar2).setVisibility(View.GONE);
    findViewById(R.id.txtUpdating).setVisibility(View.GONE);

    prefs = getSharedPreferences(PREF_NAME, 0);

    Calendar cal = Calendar.getInstance();

    //Set button texts according to days
    Button btnNextDay = (Button) findViewById(R.id.btnTomorrow);
    Button btnAfterNextDay = (Button) findViewById(R.id.btnAfterTomorrow);
    if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.THURSDAY) {
        btnAfterNextDay.setText("Hausaufgaben zu Montag");
    } else if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY
            || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {
        btnNextDay.setText("Hausaufgaben zu Montag");
        btnAfterNextDay.setText("Hausaufgaben zu Dienstag");
    }
    if (prefs.getBoolean(PREF_UPDATED, false)) {
        prefs.edit().putBoolean(PREF_UPDATED, false).apply();
        File file = new File(Environment.getExternalStorageDirectory().getPath() + "/physikbioapp-update.apk");
        file.delete();

        showChangelog();
    }

    checkForUpdates(false);
}

From source file:org.structr.common.RecurringDateHelper.java

private static int getDayOfWeek(final String shortWeekday) {

    if (shortWeekday != null && !shortWeekday.equals(""))
        try {//from   w  ww .ja  v  a 2 s .c  om
            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();/*  w  ww .  j  a va2s .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) {

    }
}