code: private TimephasedCost[] splitFirstDay(ProjectCalendar calendar, TimephasedCost assignment)
     {
        TimephasedCost[] result = new TimephasedCost[2];
  
        //
        // Retrieve data used to calculate the pro-rata work split
        //
        Date assignmentStart = assignment.getStart();
        Date assignmentFinish = assignment.getFinish();
        Duration calendarWork = calendar.getWork(assignmentStart, assignmentFinish, TimeUnit.MINUTES);
  
        if (calendarWork.getDuration() != 0)
        {
           //
           // Split the first day
           //
           Date splitFinish;
           double splitCost;
           if (calendar.isWorkingDate(assignmentStart))
           {
              Date splitStart = assignmentStart;
              Date splitFinishTime = calendar.getFinishTime(splitStart);
              splitFinish = DateHelper.setTime(splitStart, splitFinishTime);
              Duration calendarSplitWork = calendar.getWork(splitStart, splitFinish, TimeUnit.MINUTES);
              splitCost = (assignment.getTotalAmount().doubleValue() * calendarSplitWork.getDuration()) / calendarWork.getDuration();
  
              TimephasedCost split = new TimephasedCost();
              split.setStart(splitStart);
              split.setFinish(splitFinish);
              split.setTotalAmount(Double.valueOf(splitCost));
  
              result[0] = split;
           }
           else
           {
              splitFinish = assignmentStart;
              splitCost = 0;
           }
  
           //
           // Split the remainder
           //
           Date splitStart = calendar.getNextWorkStart(splitFinish);
           splitFinish = assignmentFinish;
           TimephasedCost split;
           if (splitStart.getTime() > splitFinish.getTime())
           {
              split = null;
           }
           else
           {
              splitCost = assignment.getTotalAmount().doubleValue() - splitCost;
  
              split = new TimephasedCost();
              split.setStart(splitStart);
              split.setFinish(splitFinish);
              split.setTotalAmount(Double.valueOf(splitCost));
              split.setAmountPerDay(assignment.getAmountPerDay());
           }
  
           result[1] = split;
        }
        return result;
     }
docs: This method splits the first day off of a time span.
  
  @param calendar current calendar
  @param assignment timephased assignment span
  @return first day and remainder assignments