List of usage examples for java.util Calendar SATURDAY
int SATURDAY
To view the source code for java.util Calendar SATURDAY.
Click Source Link
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 ww w . j a va2 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:net.granoeste.commons.util.DateUtils.java
/** * ????/* w w w . j a v a 2 s . c o m*/ * * @param cal * @param amount ex) last month : -1. the current month : 0. the next month : 1 */ public static void shiftDateOnSundayOfTheWeekOfTheEndOfTheMonth(final Calendar cal, final int amount) { cal.set(Calendar.DATE, 1); cal.add(Calendar.MONTH, amount); cal.add(Calendar.DATE, -1); if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) { cal.add(Calendar.DATE, 1); } else { cal.add(Calendar.DATE, 7 - cal.get(Calendar.DAY_OF_WEEK) + 1); } }
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(); }//w w w. j a v a2 s . co m return ""; }
From source file:com.espertech.esper.regression.pattern.TestCronParameter.java
public void testOperator() throws Exception { // Observer for last Sunday of month, 0 = Sunday int lastDayOfWeek = getLastDayOfWeekInMonth(0, 2007); calendar.set(2007, getCurrentMonth(2007), lastDayOfWeek, 8, 00, 00); printCurrentTime(calendar);/* w w w .java2 s.c o m*/ baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, *, *, 0 last, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last day of current month calendar.set(2007, getCurrentMonth(2007), getLastDayOfMonth(2007), 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, last, *, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last day of Auguts 2007 // For Java: January=0, February=1, March=2, April=3, May=4, June=5, // July=6, August=7, September=8, November=9, October=10, December=11 // For Esper: January=1, February=2, March=3, April=4, May=5, June=6, // July=7, August=8, September=9, November=10, October=11, December=12 calendar.set(2007, Calendar.AUGUST, 31, 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, last, 8, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last day of February 2007 calendar.set(2007, Calendar.FEBRUARY, 28, 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, last, 2, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last day of week (Saturday) Calendar calendar = Calendar.getInstance(); Date date = new Date(); calendar.setTime(date); calendar.set(Calendar.MILLISECOND, 0); calendar.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, *, *, last, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last Friday of June calendar.set(2007, Calendar.JUNE, 29, 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, *, 6, 5 last, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last weekday of the current month calendar.set(2007, getCurrentMonth(2007), getLastWeekDayOfMonth(null, 2007), 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, lastweekday, *, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last weekday of September 2007, it's Friday September 28th calendar.set(2007, Calendar.SEPTEMBER, 28, 10, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, lastweekday, 9, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last weekday of February, it's Wednesday February 28th calendar.set(2007, Calendar.FEBRUARY, 28, 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, lastweekday, 2, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for nearest weekday for current month on the 10th calendar.set(2007, getCurrentMonth(2007), getLastWeekDayOfMonth(10, 2007), 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, 10 weekday, *, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for nearest weekday of September 1st (Saturday), it's Monday September 3rd (no "jump" over month) calendar.set(2007, Calendar.SEPTEMBER, 3, 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, 1 weekday, 9, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for nearest weekday of September 30th (Sunday), it's Friday September 28th (no "jump" over month) calendar.set(2007, Calendar.SEPTEMBER, 28, 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, 30 weekday, 9, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last Friday of current month, // 0=Sunday, 1=Monday, 2=Tuesday, 3=Wednesday, 4= Thursday, 5=Friday, 6=Saturday calendar.set(2007, getCurrentMonth(2007), getLastDayOfWeekInMonth(5, 2007), 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, *, *, 5 last, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); }
From source file:net.kamhon.ieagle.util.DateUtil.java
public static boolean isSaturday(Date date) { Calendar cal = setTime(date); return cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY; }
From source file:org.projectforge.framework.time.DayHolder.java
public boolean isWeekend() { final int dayOfWeek = getDayOfWeek(); return Calendar.SUNDAY == dayOfWeek || Calendar.SATURDAY == dayOfWeek; }
From source file:org.projectforge.calendar.DayHolder.java
public boolean isWeekend() { int dayOfWeek = getDayOfWeek(); return Calendar.SUNDAY == dayOfWeek || Calendar.SATURDAY == dayOfWeek; }
From source file:org.jasig.schedassist.model.CommonDateOperations.java
/** * Helper method to calculate the first week's end date. * //from w ww .j a v a 2s . 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:de.austinpadernale.holidays.Holiday.java
public void setDayOfWeek(Integer dayOfWeek) { if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY) { throw new InvalidArgumentException("dayOfWeek", "must be between 1 and 7"); }/*from ww w . j ava2s . com*/ this.dayOfWeek = dayOfWeek; }
From source file:org.silverpeas.core.web.calendar.CalendarTimeWindowViewContext.java
private void setReferenceDay(final Date date, int offset) { // Reference date Calendar cal = DateUtil.convert(date, locale); final Date referenceDate; if (!withWeekend && (viewType.equals(WEEKLY) || viewType.equals(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); }/*from w w w. jav a 2 s . c o m*/ 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); }