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

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

public class WeekDayFunction
extends Object
implements Function

This function extracts the day of week from a date.

The returned value depends of the Type passed as second argument using the following table:

Day of Week Type=1 Result Type=2 Result Type=3 Result
Sunday 1 7 6
Monday 2 1 0
Tuesday 3 2 1
Wednesday 4 3 2
Thursday 5 4 3
Friday 6 5 4
Saturday 7 6 5

Author:
Cedric Pronzato
See Also:
Serialized Form

Constructor Summary
WeekDayFunction()
           
 
Method Summary
 int convertType(int currentDayOfWeek, int type)
           
 TypeValuePair evaluate(FormulaContext context, ParameterCallback parameters)
           
 String getCanonicalName()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeekDayFunction

public WeekDayFunction()
Method Detail

getCanonicalName

public 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

convertType

public int convertType(int currentDayOfWeek,
                       int type)