List of usage examples for java.util Calendar THURSDAY
int THURSDAY
To view the source code for java.util Calendar THURSDAY.
Click Source Link
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 ww w . j ava 2 s . c o m return ""; }
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 a 2s . co 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 w w . j ava 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();// www. ja 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: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 ww . j a v a 2 s . 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 www. ja v a 2s. 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 w w . jav a 2 s . c om return ""; }
From source file:com.netflix.simianarmy.basic.BasicCalendar.java
/** * Load holidays./* w ww .j ava 2s .co m*/ * * @param year * the year */ protected void loadHolidays(int year) { holidays.clear(); // these aren't all strictly holidays, but days when engineers will likely // not be in the office to respond to rampaging monkeys // new years, or closest work day holidays.add(workDayInYear(year, Calendar.JANUARY, 1)); // 3rd monday == MLK Day holidays.add(dayOfYear(year, Calendar.JANUARY, Calendar.MONDAY, 3)); // 3rd monday == Presidents Day holidays.add(dayOfYear(year, Calendar.FEBRUARY, Calendar.MONDAY, 3)); // last monday == Memorial Day holidays.add(dayOfYear(year, Calendar.MAY, Calendar.MONDAY, -1)); // 4th of July, or closest work day holidays.add(workDayInYear(year, Calendar.JULY, 4)); // first monday == Labor Day holidays.add(dayOfYear(year, Calendar.SEPTEMBER, Calendar.MONDAY, 1)); // second monday == Columbus Day holidays.add(dayOfYear(year, Calendar.OCTOBER, Calendar.MONDAY, 2)); // veterans day, Nov 11th, or closest work day holidays.add(workDayInYear(year, Calendar.NOVEMBER, 11)); // 4th thursday == Thanksgiving holidays.add(dayOfYear(year, Calendar.NOVEMBER, Calendar.THURSDAY, 4)); // 4th friday == "black friday", monkey goes shopping! holidays.add(dayOfYear(year, Calendar.NOVEMBER, Calendar.FRIDAY, 4)); // christmas eve holidays.add(dayOfYear(year, Calendar.DECEMBER, 24)); // christmas day holidays.add(dayOfYear(year, Calendar.DECEMBER, 25)); // day after christmas holidays.add(dayOfYear(year, Calendar.DECEMBER, 26)); // new years eve holidays.add(dayOfYear(year, Calendar.DECEMBER, 31)); // mark the holiday set with the year, so on Jan 1 it will automatically // recalculate the holidays for next year holidays.add(year); }
From source file:org.sipfoundry.sipxconfig.admin.CronScheduleTest.java
public void testGetScheduledDay() { CronSchedule schedule = new CronSchedule(); assertEquals(ScheduledDay.MONDAY, schedule.getScheduledDay()); schedule.setDayOfWeek(Calendar.THURSDAY); assertEquals(ScheduledDay.THURSDAY, schedule.getScheduledDay()); }
From source file:org.jasig.schedassist.model.CommonDateOperations.java
/** * Helper method to calculate the first week's end date. * /* w ww . j av a 2s .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; }