Class DateDifFunction
- java.lang.Object
-
- org.pentaho.reporting.libraries.formula.function.datetime.DateDifFunction
-
- All Implemented Interfaces:
Serializable,Function
public class DateDifFunction extends Object implements Function
This function returns the number of years, months, or days between two date numbers.
The Format is a code from the following table, entered as text, that specifies the format you want:format Returns the number of y Years m Months. If there is not a complete month between the dates, 0 will be returned. d Days md Days, ignoring months and years ym Months, ignoring years yd Days, ignoring years - Author:
- Cedric Pronzato
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringDAYS_CODEstatic StringDAYS_IGNORING_MONTHS_YEARSstatic StringDAYS_IGNORING_YEARSstatic StringMONTHS_CODEstatic StringMONTHS_IGNORING_YEARSstatic StringYEARS_CODE
-
Constructor Summary
Constructors Constructor Description DateDifFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longcomputeDateDifference(String formatCode, GregorianCalendar min, GregorianCalendar max, long days)protected longcomputeDays(ParameterCallback parameters, TypeRegistry typeRegistry)TypeValuePairevaluate(FormulaContext context, ParameterCallback parameters)StringgetCanonicalName()
-
-
-
Field Detail
-
YEARS_CODE
public static final String YEARS_CODE
- See Also:
- Constant Field Values
-
MONTHS_CODE
public static final String MONTHS_CODE
- See Also:
- Constant Field Values
-
DAYS_CODE
public static final String DAYS_CODE
- See Also:
- Constant Field Values
-
DAYS_IGNORING_YEARS
public static final String DAYS_IGNORING_YEARS
- See Also:
- Constant Field Values
-
MONTHS_IGNORING_YEARS
public static final String MONTHS_IGNORING_YEARS
- See Also:
- Constant Field Values
-
DAYS_IGNORING_MONTHS_YEARS
public static final String DAYS_IGNORING_MONTHS_YEARS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCanonicalName
public String getCanonicalName()
- Specified by:
getCanonicalNamein interfaceFunction
-
evaluate
public TypeValuePair evaluate(FormulaContext context, ParameterCallback parameters) throws EvaluationException
- Specified by:
evaluatein interfaceFunction- Throws:
EvaluationException
-
computeDays
protected long computeDays(ParameterCallback parameters, TypeRegistry typeRegistry) throws EvaluationException
- Throws:
EvaluationException
-
computeDateDifference
protected long computeDateDifference(String formatCode, GregorianCalendar min, GregorianCalendar max, long days) throws EvaluationException
- Throws:
EvaluationException
-
-