org.pentaho.reporting.libraries.formula.function.datetime
Class DateDifFunction

java.lang.Object
  extended by org.pentaho.reporting.libraries.formula.function.datetime.DateDifFunction
All Implemented Interfaces:
java.io.Serializable, Function

public class DateDifFunction
extends java.lang.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
static java.lang.String DAYS_CODE
           
static java.lang.String DAYS_IGNORING_MONTHS_YEARS
           
static java.lang.String DAYS_IGNORING_YEARS
           
static java.lang.String MONTHS_CODE
           
static java.lang.String MONTHS_IGNORING_YEARS
           
static java.lang.String YEARS_CODE
           
 
Constructor Summary
DateDifFunction()
           
 
Method Summary
 TypeValuePair evaluate(FormulaContext context, ParameterCallback parameters)
           
 java.lang.String getCanonicalName()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

YEARS_CODE

public static final java.lang.String YEARS_CODE
See Also:
Constant Field Values

MONTHS_CODE

public static final java.lang.String MONTHS_CODE
See Also:
Constant Field Values

DAYS_CODE

public static final java.lang.String DAYS_CODE
See Also:
Constant Field Values

DAYS_IGNORING_YEARS

public static final java.lang.String DAYS_IGNORING_YEARS
See Also:
Constant Field Values

MONTHS_IGNORING_YEARS

public static final java.lang.String MONTHS_IGNORING_YEARS
See Also:
Constant Field Values

DAYS_IGNORING_MONTHS_YEARS

public static final java.lang.String DAYS_IGNORING_MONTHS_YEARS
See Also:
Constant Field Values
Constructor Detail

DateDifFunction

public DateDifFunction()
Method Detail

getCanonicalName

public java.lang.String getCanonicalName()
Specified by:
getCanonicalName in interface Function

evaluate

public TypeValuePair evaluate(FormulaContext context,
                              ParameterCallback parameters)
                       throws EvaluationException
Specified by:
evaluate in interface Function
Throws:
EvaluationException