Example usage for java.util Calendar FRIDAY

List of usage examples for java.util Calendar FRIDAY

Introduction

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

Prototype

int FRIDAY

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

Click Source Link

Document

Value of the #DAY_OF_WEEK field indicating Friday.

Usage

From source file:ai.ilikeplaces.logic.sits9.SubscriberNotifications.java

@Override
public void startTimer() {
    final int timeout = TGIF_TIMING == 0 ? 7 //Days of Week
            * 24 //Hour of Day
            * 60 //Minutes of Hour
            * 60 //Seconds of Minute
            * 1000 //Milliseconds of Second
            : TGIF_TIMING;//w  w  w. j a v  a  2 s  .co  m

    final SmartLogger sl = SmartLogger.start(Loggers.LEVEL.INFO, Loggers.CODE_MEMC + "HELLO, STARTING "
            + this.getClass().getSimpleName() + " TIMER  WITH TIMER INTERVAL:" + timeout, 60000, null, true);

    final Calendar _calendar = Calendar.getInstance();
    final int todayDay = _calendar.get(Calendar.DAY_OF_WEEK);
    if (todayDay != Calendar.FRIDAY) {
        _calendar.add(Calendar.DAY_OF_YEAR, (Calendar.SATURDAY - todayDay + 6) % 7);
    }

    if (TGIF_TIMING == 0) {
        final Date _time = _calendar.getTime();
        timerService.createTimer(_time, timeout, null);
        String format = new SimpleDateFormat("yyyy/MM/dd").format(_time);
        sl.appendToLogMSG("Starting timer on " + format);
    } else {
        timerService.createTimer(0, timeout, null);
    }

    if (TGIF_ON_STARTUP == 1) {
        final Calendar now = Calendar.getInstance();
        now.add(Calendar.SECOND, 30);
        timerService.createTimer(now.getTime(), timeout, null);
    }

    sl.complete(Loggers.LEVEL.INFO, Loggers.DONE);
}

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

/**
 * Initial method //from w  w w. ja  v a 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: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   ww  w  . j a 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 av  a2  s.c om
    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  .c o 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: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();//from  w ww .  ja  va  2s  . 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 {// w ww . j a  v  a  2s.  c o  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();//  ww w.  java  2s.  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  w  w w.  j av 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.openvpms.web.echo.date.RelativeDateParser.java

/**
 * Parses a date relative to the specified date.
 *
 * @param source the relative date string
 * @param date   the date/* w ww.j a  v  a 2s  .c om*/
 * @return the relative date, or <code>null</code> if the source is invalid
 */
public Date parse(String source, Date date) {
    if (StringUtils.isEmpty(source)) {
        return null;
    }
    Matcher matcher = pattern.matcher(source.toLowerCase());
    Calendar calendar;
    calendar = new GregorianCalendar();
    calendar.setTime(date);
    int start = 0;
    boolean neg = false;
    boolean first = true;
    while (start < source.length() && matcher.find(start)) {
        if (start != matcher.start()) {
            return null;
        }
        String valueGroup = matcher.group(1);
        int value = Integer.parseInt(valueGroup);
        if (first) {
            if (value < 0) {
                neg = true;
            }
            first = false;
        } else if (value >= 0 && valueGroup.charAt(0) != '+' && neg) {
            // if there is a leading sign, and the current value has no explicit +, it propagates to all
            // other patterns where no sign is specified
            value = -value;
        }
        String field = matcher.group(2);
        String se = matcher.group(3); // get any s=start or e=end
        if (field.equals("d")) {
            calendar.add(Calendar.DAY_OF_MONTH, value);
            // se ignored if day
        } else if (field.equals("m")) {
            calendar.add(Calendar.MONTH, value);
            if (se.equals("s")) {
                calendar.set(Calendar.DAY_OF_MONTH, 1); // set 1st of month
            } else if (se.equals("e")) {
                calendar.set(Calendar.DAY_OF_MONTH, 1); // set 1st of month
                calendar.add(Calendar.MONTH, 1); // go to next month
                calendar.add(Calendar.DAY_OF_MONTH, -1); // back one to to get end of month
            }
        } else if (field.equals("w")) {
            calendar.add(Calendar.WEEK_OF_YEAR, value);
            if (se.equals("s")) {
                calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); //set Monday
            } else if (se.equals("e")) {
                calendar.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); //set Friday
            }
        } else if (field.equals("q")) { // quarter
            calendar.add(Calendar.MONTH, 3 * value); // move by 3 month blocks
            if (se.equals("s")) {
                calendar.set(Calendar.DAY_OF_MONTH, 1); // set 1st of month
                int k = calendar.get(Calendar.MONTH); // get month (0 = Jan)
                k = (k / 3) * 3; // get month number at start of quarter (0,3,6,9)
                calendar.set(Calendar.MONTH, k); // set that month
            } else if (se.equals("e")) {
                calendar.set(Calendar.DAY_OF_MONTH, 1); // set 1st of month
                int k = calendar.get(Calendar.MONTH); // get month (0 = Jan)
                k = (k / 3) * 3; // get month number at start of quarter (0,3,6,9)
                calendar.set(Calendar.MONTH, k); // set that month
                calendar.add(Calendar.MONTH, 3); // go to next quarter
                calendar.add(Calendar.DAY_OF_MONTH, -1); // back one day to to get end of quarter
            }
        } else {
            calendar.add(Calendar.YEAR, value);
            if (se.equals("s")) {
                calendar.set(Calendar.DAY_OF_MONTH, 1); // set 1st of month
                calendar.set(Calendar.MONTH, Calendar.JANUARY); // set January
            } else if (se.equals("e")) {
                calendar.set(Calendar.DAY_OF_MONTH, 1); // set 1st of month
                calendar.set(Calendar.MONTH, Calendar.JANUARY); // set January
                calendar.add(Calendar.YEAR, 1); // go to next year
                calendar.add(Calendar.DAY_OF_MONTH, -1); // back one to to get 31 Dec
            }
        }

        start = matcher.end();
    }
    return (start == source.length()) ? calendar.getTime() : null;
}