List of utility methods to do Day of Work
Date | addWorkdays(Date date, int workdayOffset) Die Anzahl Arbeitstage (d.h. final Calendar cal = getCalendarInstance(); cal.setTime(date); ensureWorkday(cal); for (int countdown = workdayOffset; countdown > 0; countdown--) { cal.add(Calendar.DAY_OF_YEAR, 1); ensureWorkday(cal); final Date result = cal.getTime(); ... |
Date | addWorkingDays(Date start, int workingDays) Takes a start date and adds the specified number of working days to it. if (workingDays < 0) { throw new IllegalArgumentException("Subtracting of working days is currently not supported."); } else if (workingDays == 0) { return start; } else { final GregorianCalendar cal = new GregorianCalendar(); cal.setTime(start); final int startDay = cal.get(Calendar.DAY_OF_WEEK); ... |
int | getRemainingWorkingMonth(Date taxdate) get Remaining Working Month Calendar calendar = Calendar.getInstance(); calendar.setTime(taxdate); int month = calendar.get(Calendar.MONTH) + 1; return 12 - month; |
int | getWorkDay(Date d1, Date d2, int[] freeDays) get Work Day int dNum = 0; dNum = (int) ((d2.getTime() - d1.getTime()) / 1000 / 60 / 60 / 24) + 1; return dNum - getFreeDay(d1, dNum, freeDays); |
boolean | isWorkDay(Date data) is Work Day int theDay = getCalendar(data).get(Calendar.DAY_OF_WEEK); return theDay != Calendar.SUNDAY && theDay != Calendar.SATURDAY; |
boolean | isWorkDay(Date date) is Work Day if (date == null) { throw new IllegalArgumentException("date is null."); boolean ret = true; Calendar cal = Calendar.getInstance(); cal.setTime(date); int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); if (dayOfWeek == Calendar.SATURDAY || dayOfWeek == Calendar.SUNDAY) { ... |
boolean | isWorkday(Date date) is Workday Calendar cal = Calendar.getInstance(); if (date != null) { cal.setTime(date); int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); return !(dayOfWeek == Calendar.SATURDAY || dayOfWeek == Calendar.SUNDAY); |
boolean | isWorking(final Date date) is Working final int hourOfDay = getHourOfDay(date); if (hourOfDay > 8 && hourOfDay < 19) { return true; return false; |