public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {if (args.length != 2) {return ErrorEval.VALUE_INVALID;}try {double startDateAsNumber = getValue(args[0]);int offsetInMonthAsNumber = (int) getValue(args[1]);Date startDate = DateUtil.getJavaDate(startDateAsNumber);if (startDate == null) {return ErrorEval.VALUE_INVALID;}Calendar calendar = LocaleUtil.getLocaleCalendar();calendar.setTime(startDate);calendar.add(Calendar.MONTH, offsetInMonthAsNumber);return new NumberEval(DateUtil.getExcelDate(calendar.getTime()));} catch (EvaluationException e) {return e.getErrorEval();}}
public ValueEval Evaluate(ValueEval[] args, OperationEvaluationContext ec){double result;if (args.Length != 2){return ErrorEval.VALUE_INVALID;}try{double startDateAsNumber = GetValue(args[0]);int offsetInMonthAsNumber = (int)GetValue(args[1]);DateTime startDate = DateUtil.GetJavaDate(startDateAsNumber);DateTime resultDate = startDate.AddMonths(offsetInMonthAsNumber);result = DateUtil.GetExcelDate(resultDate);NumericFunction.CheckValue(result);return new NumberEval(result);}catch (EvaluationException e){return e.GetErrorEval();}}