List of usage examples for java.util Calendar FRIDAY
int FRIDAY
To view the source code for java.util Calendar FRIDAY.
Click Source Link
From source file:com.silverpeas.scheduler.simple.SchedulerJob.java
/** * This method sets the scheduling parameter. The time settings are given by vectors. Each vector * holds a list of Integer objects (currently ordered). Every Integer represents a element of a * timestamp (cron like).// ww w . j av a 2s .c o m * @param startMinutes A list of minutes (0-59) * @param startHours A list of hours (0-23) * @param startDaysOfMonth A list of days of a month (1-31) * @param startMonths A list of months (1-12; starts with 1 for January) * @param startDaysOfWeek A list of day of a week (0-6; starts with 0 for Sunday) */ protected synchronized void setSchedulingParameter(List<Integer> startMinutes, List<Integer> startHours, List<Integer> startDaysOfMonth, List<Integer> startMonths, List<Integer> startDaysOfWeek) throws SchedulerException { Enumeration vectorEnumerator; List<Integer> workVector; int workInt; // Check minute values if (startMinutes == null) { startMinutes = new ArrayList<Integer>(); } for (Integer minute : startMinutes) { try { workInt = minute; if ((workInt < 0) || (workInt > 59)) { throw new SchedulerException("SchedulerMethodJob.setParameter: A minute value is out of range"); } } catch (ClassCastException aException) { throw new SchedulerException("SchedulerMethodJob.setParameter: Can't convert a minute value"); } } // Check hour values if (startHours == null) { startHours = new ArrayList<Integer>(); } for (Integer hours : startHours) { try { workInt = hours; if ((workInt < 0) || (workInt > 23)) { throw new SchedulerException("SchedulerMethodJob.setParameter: A hour value is out of range"); } } catch (ClassCastException aException) { throw new SchedulerException("SchedulerMethodJob.setParameter: Can't convert a hour value"); } } // Check day of month values if (startDaysOfMonth == null) { startDaysOfMonth = new ArrayList<Integer>(); } for (Integer days : startDaysOfMonth) { try { workInt = days; if ((workInt < 1) || (workInt > 31)) { throw new SchedulerException( "SchedulerMethodJob.setParameter: A day of month value is out of range"); } } catch (ClassCastException aException) { throw new SchedulerException("SchedulerMethodJob.setParameter: Can't convert a day of month value"); } } // Check month values and normalize them for internal usage if (startMonths == null) { startMonths = new ArrayList<Integer>(); } workVector = new ArrayList<Integer>(); for (Integer month : startMonths) { try { workInt = month; if ((workInt < 1) || (workInt > 12)) { throw new SchedulerException("SchedulerMethodJob.setParameter: A month value is out of range"); } workVector.add(workInt - 1); // Internal: zero based } catch (ClassCastException aException) { throw new SchedulerException("SchedulerMethodJob.setParameter: Can't convert a month value"); } } startMonths = workVector; // Check day of week values if (startDaysOfWeek == null) { startDaysOfWeek = new ArrayList<Integer>(); } workVector = new ArrayList<Integer>(); for (Integer daysOfWeek : startDaysOfWeek) { try { workInt = daysOfWeek; if ((workInt < 0) || (workInt > 6)) { throw new SchedulerException( "SchedulerMethodJob.setParameter: A day of week value is out of range"); } // Conversion not realy necessary, but what if SUN changes the // implementation .... :-)) switch (workInt) { case 0: workVector.add(Calendar.SUNDAY); break; case 1: workVector.add(Calendar.MONDAY); break; case 2: workVector.add(Calendar.TUESDAY); break; case 3: workVector.add(Calendar.WEDNESDAY); break; case 4: workVector.add(Calendar.THURSDAY); break; case 5: workVector.add(Calendar.FRIDAY); break; case 6: workVector.add(Calendar.SATURDAY); break; } } catch (ClassCastException aException) { throw new SchedulerException("SchedulerMethodJob.setParameter: Can't convert a day of week value"); } } startDaysOfWeek = workVector; // Assign the calculated values vMinutes = startMinutes; vHours = startHours; vDaysOfMonth = startDaysOfMonth; vMonths = startMonths; vDaysOfWeek = startDaysOfWeek; // Sort the calculated vectors sortCronVectors(); }
From source file:org.activequant.util.charting.IntradayMarketTimeline.java
private long getStartTime(int day) { long startTime = 0; if (day == Calendar.SUNDAY) { startTime = this.sundayStart; } else if (day == Calendar.MONDAY) { startTime = this.mondayStart; } else if (day == Calendar.TUESDAY) { startTime = this.tuesdayStart; } else if (day == Calendar.WEDNESDAY) { startTime = this.wednesdayStart; } else if (day == Calendar.THURSDAY) { startTime = this.thursdayStart; } else if (day == Calendar.FRIDAY) { startTime = this.fridayStart; } else if (day == Calendar.SATURDAY) { startTime = this.saturdayStart; }//from w w w . j ava 2 s .c om return startTime; }
From source file:org.activequant.util.charting.IntradayMarketTimeline.java
private long getEndTime(int day) { long endTime = 0; if (day == Calendar.SUNDAY) { endTime = this.sundayEnd; } else if (day == Calendar.MONDAY) { endTime = this.mondayEnd; } else if (day == Calendar.TUESDAY) { endTime = this.tuesdayEnd; } else if (day == Calendar.WEDNESDAY) { endTime = this.wednesdayEnd; } else if (day == Calendar.THURSDAY) { endTime = this.thursdayEnd; } else if (day == Calendar.FRIDAY) { endTime = this.fridayEnd; } else if (day == Calendar.SATURDAY) { endTime = this.saturdayEnd; }/*from w w w.j a v a2 s . co m*/ return endTime; }
From source file:org.hawkular.alerts.api.model.action.TimeConstraint.java
private int day(String sDay) { if (isEmpty(sDay)) { return -1; }/*ww w. j a v a 2 s . c o m*/ if (sDay.length() < 3) { return -1; } String prefix = sDay.substring(0, 3).toLowerCase(); DAY d = DAY.fromString(prefix); if (d == null) { return -1; } switch (d) { case SUNDAY: return Calendar.SUNDAY; 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; default: return -1; } }
From source file:org.eevolution.form.CRP.java
/** * Create Category Dataset based on Weight , date start and resource * @param start/*w w w. ja va 2 s . c o m*/ * @param resource * @return CategoryDataset */ protected CategoryDataset createWeightDataset(Timestamp start, MResource rosource) { GregorianCalendar gc1 = new GregorianCalendar(); gc1.setTimeInMillis(start.getTime()); gc1.clear(Calendar.MILLISECOND); gc1.clear(Calendar.SECOND); gc1.clear(Calendar.MINUTE); gc1.clear(Calendar.HOUR_OF_DAY); String namecapacity = Msg.translate(Env.getCtx(), "Capacity"); String nameload = Msg.translate(Env.getCtx(), "Load"); String namesummary = Msg.translate(Env.getCtx(), "Summary"); String namepossiblecapacity = "Possible Capacity"; MResourceType t = MResourceType.get(Env.getCtx(), rosource.getS_ResourceType_ID()); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); double currentweight = DB.getSQLValue(null, "SELECT SUM( (mo.qtyordered-mo.qtydelivered)*(SELECT mp.weight FROM M_Product mp WHERE mo.m_product_id=mp.m_product_id )) FROM PP_Order mo WHERE AD_Client_ID=?", rosource.getAD_Client_ID()); double dailyCapacity = rosource.getDailyCapacity().doubleValue(); double utilization = rosource.getPercentUtilization().doubleValue(); double summary = 0; int day = 0; while (day < 32) { day++; switch (gc1.get(Calendar.DAY_OF_WEEK)) { case Calendar.SUNDAY: if (t.isOnSunday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.MONDAY: if (t.isOnMonday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.TUESDAY: if (t.isOnTuesday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.WEDNESDAY: if (t.isOnWednesday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.THURSDAY: if (t.isOnThursday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.FRIDAY: if (t.isOnFriday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.SATURDAY: if (t.isOnSaturday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; } dataset.addValue(currentweight, nameload, new Integer(day)); dataset.addValue(summary, namesummary, new Integer(day)); gc1.add(Calendar.DATE, 1); } return dataset; }
From source file:org.activequant.util.charting.IntradayMarketTimeline.java
private boolean isActiveDate(Calendar cal) { int day = cal.get(Calendar.DAY_OF_WEEK); long timeSinceStart = cal.get(Calendar.HOUR_OF_DAY) * 3600000 + cal.get(Calendar.MINUTE) * 60000 + cal.get(Calendar.SECOND) * 1000; if (day == Calendar.SUNDAY) { return (timeSinceStart > this.sundayStart && timeSinceStart < this.sundayEnd); } else if (day == Calendar.MONDAY) { return (timeSinceStart > this.mondayStart && timeSinceStart < this.mondayEnd); } else if (day == Calendar.TUESDAY) { return (timeSinceStart > this.tuesdayStart && timeSinceStart < this.tuesdayEnd); } else if (day == Calendar.WEDNESDAY) { return (timeSinceStart > this.wednesdayStart && timeSinceStart < this.wednesdayEnd); } else if (day == Calendar.THURSDAY) { return (timeSinceStart > this.thursdayStart && timeSinceStart < this.thursdayEnd); } else if (day == Calendar.FRIDAY) { return (timeSinceStart > this.fridayStart && timeSinceStart < this.fridayEnd); } else if (day == Calendar.SATURDAY) { return (timeSinceStart > this.saturdayStart && timeSinceStart < this.saturdayEnd); } else {/*from w w w .j a va 2s . co m*/ return false; } }
From source file:com.jdo.CloudContactUtils.java
public static String getDay() { int d = Calendar.getInstance().get(Calendar.DAY_OF_WEEK); String day = "sun"; switch (d) {/*from w w w.java 2 s . com*/ case Calendar.SUNDAY: day = "sun"; break; case Calendar.MONDAY: day = "mon"; break; case Calendar.TUESDAY: day = "tue"; break; case Calendar.WEDNESDAY: day = "wed"; break; case Calendar.THURSDAY: day = "thu"; break; case Calendar.FRIDAY: day = "fri"; break; case Calendar.SATURDAY: day = "sat"; break; } return day; }
From source file:org.eevolution.form.VSCRP.java
public CategoryDataset createWeightDataset(Timestamp start, MResource r) { GregorianCalendar gc1 = new GregorianCalendar(); gc1.setTimeInMillis(start.getTime()); gc1.clear(Calendar.MILLISECOND); gc1.clear(Calendar.SECOND);// w ww . j a v a 2 s . c o m gc1.clear(Calendar.MINUTE); gc1.clear(Calendar.HOUR_OF_DAY); String namecapacity = Msg.translate(Env.getCtx(), "Capacity"); String nameload = Msg.translate(Env.getCtx(), "Load"); String namesummary = Msg.translate(Env.getCtx(), "Summary"); String namepossiblecapacity = "Possible Capacity"; MResourceType t = new MResourceType(Env.getCtx(), r.getS_ResourceType_ID(), null); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); double currentweight = DB.getSQLValue(null, "Select SUM( (mo.qtyordered-mo.qtydelivered)*(Select mp.weight From m_product mp Where mo.m_product_id=mp.m_product_id ) )From mpc_order mo Where ad_client_id=?", r.getAD_Client_ID()); // fjviejo e-evolution machineqty capacidad por el numero de maquinas // double dailyCapacity = DB.getSQLValue(null,"Select dailycapacity From s_resource Where s_resource_id=?",r.getS_Resource_ID()); double dailyCapacity = DB.getSQLValue(null, "Select dailycapacity*MachineQty From s_resource Where s_resource_id=?", r.getS_Resource_ID()); System.out.println("***** Capacidad diaria " + dailyCapacity); // e-evolution end double utilization = DB.getSQLValue(null, "Select percentutillization From s_resource Where s_resource_id=?", r.getS_Resource_ID()); double summary = 0; int day = 0; while (day < 32) { day++; switch (gc1.get(Calendar.DAY_OF_WEEK)) { case Calendar.SUNDAY: if (t.isOnSunday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.MONDAY: if (t.isOnMonday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.TUESDAY: if (t.isOnTuesday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.WEDNESDAY: if (t.isOnWednesday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.THURSDAY: if (t.isOnThursday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.FRIDAY: if (t.isOnFriday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.SATURDAY: if (t.isOnSaturday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; } dataset.addValue(currentweight, nameload, new Integer(day)); dataset.addValue(summary, namesummary, new Integer(day)); gc1.add(Calendar.DATE, 1); } return dataset; }
From source file:org.eevolution.form.VCRP.java
public CategoryDataset createWeightDataset(Timestamp start, MResource r) { GregorianCalendar gc1 = new GregorianCalendar(); gc1.setTimeInMillis(start.getTime()); gc1.clear(Calendar.MILLISECOND); gc1.clear(Calendar.SECOND);/*from ww w .j ava 2s . com*/ gc1.clear(Calendar.MINUTE); gc1.clear(Calendar.HOUR_OF_DAY); String namecapacity = Msg.translate(Env.getCtx(), "Capacity"); String nameload = Msg.translate(Env.getCtx(), "Load"); String namesummary = Msg.translate(Env.getCtx(), "Summary"); String namepossiblecapacity = "Possible Capacity"; MResourceType t = new MResourceType(Env.getCtx(), r.getS_ResourceType_ID(), null); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); double currentweight = DB.getSQLValue(null, "Select SUM( (mo.qtyordered-mo.qtydelivered)*(Select mp.weight From m_product mp Where mo.m_product_id=mp.m_product_id ) )From mpc_order mo Where ad_client_id=?", r.getAD_Client_ID()); // fjviejo e-evolution machineqty capacidad por el numero de maquinas // double dailyCapacity = DB.getSQLValue(null,"Select dailycapacity From s_resource Where s_resource_id=?",r.getS_Resource_ID()); double dailyCapacity = DB.getSQLValue(null, "Select dailycapacity*MachineQty From s_resource Where s_resource_id=?", r.getS_Resource_ID()); System.out.println("***** Capacidad diaria " + dailyCapacity); // e-evolution end double utilization = DB.getSQLValue(null, "Select percentutillization From s_resource Where s_resource_id=?", r.getS_Resource_ID()); double summary = 0; int day = 0; /* * Vit4B Modificado para que tome 28 dias y * * */ while (day < 29) { day++; switch (gc1.get(Calendar.DAY_OF_WEEK)) { case Calendar.SUNDAY: if (t.isOnSunday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.MONDAY: if (t.isOnMonday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.TUESDAY: if (t.isOnTuesday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.WEDNESDAY: if (t.isOnWednesday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.THURSDAY: if (t.isOnThursday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.FRIDAY: if (t.isOnFriday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.SATURDAY: if (t.isOnSaturday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; } dataset.addValue(currentweight, nameload, new Integer(day)); dataset.addValue(summary, namesummary, new Integer(day)); gc1.add(Calendar.DATE, 1); } return dataset; }
From source file:org.activequant.util.charting.IntradayMarketTimeline.java
private boolean isActiveDate(Calendar cal, Calendar cal2) { int day = cal.get(Calendar.DAY_OF_WEEK); long timeSinceStart = cal.get(Calendar.HOUR_OF_DAY) * 3600000 + cal.get(Calendar.MINUTE) * 60000 + cal.get(Calendar.SECOND) * 1000; boolean firstDate = false; if (day == Calendar.SUNDAY) { firstDate = (timeSinceStart > this.sundayStart && timeSinceStart < this.sundayEnd); } else if (day == Calendar.MONDAY) { firstDate = (timeSinceStart > this.mondayStart && timeSinceStart < this.mondayEnd); } else if (day == Calendar.TUESDAY) { firstDate = (timeSinceStart > this.tuesdayStart && timeSinceStart < this.tuesdayEnd); } else if (day == Calendar.WEDNESDAY) { firstDate = (timeSinceStart > this.wednesdayStart && timeSinceStart < this.wednesdayEnd); } else if (day == Calendar.THURSDAY) { firstDate = (timeSinceStart > this.thursdayStart && timeSinceStart < this.thursdayEnd); } else if (day == Calendar.FRIDAY) { firstDate = (timeSinceStart > this.fridayStart && timeSinceStart < this.fridayEnd); } else if (day == Calendar.SATURDAY) { firstDate = (timeSinceStart > this.saturdayStart && timeSinceStart < this.saturdayEnd); } else {//from ww w. j a v a 2 s .co m firstDate = false; } int day2 = cal2.get(Calendar.DAY_OF_WEEK); timeSinceStart = cal2.get(Calendar.HOUR_OF_DAY) * 3600000 + cal2.get(Calendar.MINUTE) * 60000 + cal2.get(Calendar.SECOND) * 1000; boolean secondDate = false; if (day2 == Calendar.SUNDAY) { secondDate = (timeSinceStart > this.sundayStart && timeSinceStart < this.sundayEnd); } else if (day2 == Calendar.MONDAY) { secondDate = (timeSinceStart > this.mondayStart && timeSinceStart < this.mondayEnd); } else if (day2 == Calendar.TUESDAY) { secondDate = (timeSinceStart > this.tuesdayStart && timeSinceStart < this.tuesdayEnd); } else if (day2 == Calendar.WEDNESDAY) { secondDate = (timeSinceStart > this.wednesdayStart && timeSinceStart < this.wednesdayEnd); } else if (day2 == Calendar.THURSDAY) { secondDate = (timeSinceStart > this.thursdayStart && timeSinceStart < this.thursdayEnd); } else if (day2 == Calendar.FRIDAY) { secondDate = (timeSinceStart > this.fridayStart && timeSinceStart < this.fridayEnd); } else if (day2 == Calendar.SATURDAY) { secondDate = (timeSinceStart > this.saturdayStart && timeSinceStart < this.saturdayEnd); } else { secondDate = false; } return (firstDate && secondDate); }