code: private void updateToNextWorkStart(Calendar cal)
     {
        Date originalDate = cal.getTime();
  
        //
        // Find the date ranges for the current day
        //
        ProjectCalendarDateRanges ranges = getRanges(originalDate, cal, null);
  
        if (ranges != null)
        {
           //
           // Do we have a start time today?
           //
           Date calTime = DateHelper.getCanonicalTime(cal.getTime());
           Date startTime = null;
           for (DateRange range : ranges)
           {
              Date rangeStart = DateHelper.getCanonicalTime(range.getStart());
              Date rangeEnd = DateHelper.getCanonicalTime(range.getEnd());
              Date rangeStartDay = DateHelper.getDayStartDate(range.getStart());
              Date rangeEndDay = DateHelper.getDayStartDate(range.getEnd());
  
              if (rangeStartDay.getTime() != rangeEndDay.getTime())
              {
                 rangeEnd = DateHelper.addDays(rangeEnd, 1);
              }
  
              if (calTime.getTime() < rangeEnd.getTime())
              {
                 if (calTime.getTime() > rangeStart.getTime())
                 {
                    startTime = calTime;
                 }
                 else
                 {
                    startTime = rangeStart;
                 }
                 break;
              }
           }
  
           //
           // If we don't have a start time today - find the next working day
           // then retrieve the start time.
           //
           if (startTime == null)
           {
              Day day;
              int nonWorkingDayCount = 0;
              do
              {
                 cal.set(Calendar.DAY_OF_YEAR, cal.get(Calendar.DAY_OF_YEAR) + 1);
                 day = Day.getInstance(cal.get(Calendar.DAY_OF_WEEK));
                 ++nonWorkingDayCount;
                 if (nonWorkingDayCount > MAX_NONWORKING_DAYS)
                 {
                    cal.setTime(originalDate);
                    break;
                 }
              }
              while (!isWorkingDate(cal.getTime(), day));
  
              startTime = getStartTime(cal.getTime());
           }
  
           DateHelper.setTime(cal, startTime);
        }
     }
docs: This method finds the start of the next working period.
  
  @param cal current Calendar instance