Retrieves the time at which work finishes on the given date, or returns
null if this is a non-working day.

@param date Date instance
@return finish time, or null for non-working day
549463
public Date getFinishTime(Date date)
   {
      Date result = null;

      if (date != null)
      {
         ProjectCalendarDateRanges ranges = getRanges(date, null, null);
         if (ranges == null)
         {
            result = getParentFile().getProjectProperties().getDefaultEndTime();
            result = DateHelper.getCanonicalTime(result);
         }
         else
         {
            Date rangeStart = result = ranges.getRange(0).getStart();
            Date rangeFinish = ranges.getRange(ranges.getRangeCount() - 1).getEnd();
            Date startDay = DateHelper.getDayStartDate(rangeStart);
            Date finishDay = DateHelper.getDayStartDate(rangeFinish);

            result = DateHelper.getCanonicalTime(rangeFinish);

            //
            // Handle the case where the end of the range is at midnight -
            // this will show up as the start and end days not matching
            //
            if (startDay != null && finishDay != null && startDay.getTime() != finishDay.getTime())
            {
               result = DateHelper.addDays(result, 1);
            }
         }
      }
      return result;
   }
856667
public boolean checkDate(Date date) {
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(date);
		calendar.set(Calendar.HOUR_OF_DAY, 0);
		calendar.set(Calendar.MINUTE, 0);
		calendar.set(Calendar.SECOND, 0);
		calendar.set(Calendar.MILLISECOND, 0);

		Calendar minCal = Calendar.getInstance();
		minCal.setTime(minSelectableDate);
		minCal.set(Calendar.HOUR_OF_DAY, 0);
		minCal.set(Calendar.MINUTE, 0);
		minCal.set(Calendar.SECOND, 0);
		minCal.set(Calendar.MILLISECOND, 0);

		Calendar maxCal = Calendar.getInstance();
		maxCal.setTime(maxSelectableDate);
		maxCal.set(Calendar.HOUR_OF_DAY, 0);
		maxCal.set(Calendar.MINUTE, 0);
		maxCal.set(Calendar.SECOND, 0);
		maxCal.set(Calendar.MILLISECOND, 0);

		return !(calendar.before(minCal) || calendar.after(maxCal));
	}
157893
public static Date parseAWSDate(String date) {
		if (date == null) {
			return null;
		}
		return TIME_FORMATTER.parseDateTime(date).toDate();
	}
118027
private static Calendar buildCalendar(final Date date) {

    Calendar calendar = buildCalendar();
    calendar.setTime(date);
    return calendar;
  }
76614
public static Date getLastDayOfMonth(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        int firstDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
        return org.apache.commons.lang.time.DateUtils.setDays(date, firstDay);
    }
635335
private static Calendar getCalendar(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        return calendar;
    }
471566
public Date getStartTime(Date date)
   {
      Date result = m_startTimeCache.get(date);
      if (result == null)
      {
         ProjectCalendarDateRanges ranges = getRanges(date, null, null);
         if (ranges == null)
         {
            result = getParentFile().getProjectProperties().getDefaultStartTime();
         }
         else
         {
            result = ranges.getRange(0).getStart();
         }
         result = DateHelper.getCanonicalTime(result);
         m_startTimeCache.put(new Date(date.getTime()), result);
      }
      return result;
   }
914017
public static int getHours(final Date date)
	{
		final Calendar calendar = Calendar.getInstance();
		calendar.setTime(date);
		return calendar.get(Calendar.HOUR_OF_DAY);
	}
931790
public static Date getDayBegin(Date date) {
        String format = DateFormatUtils.format(date, DATE_PATTERN);
        return parseDate(format.concat(" 00:00:00"));
    }
1280666
public static Date parseTimestamp(String date) {
		try {
			return hasText(date) ? timestampParser.parse(date) : null;
		} catch (ParseException e) {
			logger.log(Level.WARNING, "parseTimestamp - ParseException caught.", e);
		}

		return null;
	}
343664
public String getDate(Date date) {

        return CmsDateUtil.getDate(date, DateFormat.SHORT, m_locale);
    }
840043
public static String toTimeString(java.util.Date date) {
		if (date == null)
			return "";
		Calendar calendar = Calendar.getInstance();

		calendar.setTime(date);
		return (toTimeString(calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND)));
	}
89180
public Date getNextWorkStart(Date date)
   {
      Calendar cal = Calendar.getInstance();
      cal.setTime(date);
      updateToNextWorkStart(cal);
      return cal.getTime();
   }
823425
public Date getTimeAfter(Date afterTime) {
    Calendar date = new GregorianCalendar();
    date.setTime(afterTime);

    Calendar after = getTimeAfter(date);

    return after == null ? null : after.getTime();
  }
715023
public static Date getLastDateOfMonth(Date date) {

        if (date == null)
            return null;

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
        return calendar.getTime();
    }
126854
public static int getWeek(Date date) {
        CALENDAR.setTime(date);
        return CALENDAR.get(Calendar.DAY_OF_WEEK);
    }
231418
public static Date getDateOfHoursBack(final int hoursBack, final Date date) {

    return dateBack(Calendar.HOUR_OF_DAY, hoursBack, date);
  }