Top Description Fields Constructors Methods
org.apache.poi.ss.formula.functions

public Class WeekNum

extends Fixed2ArgFunction
implements FreeRefFunction
Class Inheritance
All Implemented Interfaces
org.apache.poi.ss.formula.functions.FreeRefFunction
Imports
java.time.DayOfWeek, .LocalDate, .ZoneId, java.time.temporal.WeekFields, java.util.Arrays, .Date, .HashSet, org.apache.poi.ss.formula.OperationEvaluationContext, org.apache.poi.ss.formula.eval.ErrorEval, .EvaluationException, .MissingArgEval, .NumberEval, .OperandResolver, .ValueEval, org.apache.poi.ss.usermodel.DateUtil

Implementation for Excel WeekNum() function.

Syntax:
WeekNum (Serial_num,Return_type)

Returns a number that indicates where the week falls numerically within a year.

Serial_num is a date within the week. Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text. Return_type is a number that determines on which day the week begins. The default is 1. 1 Week begins on Sunday. Weekdays are numbered 1 through 7. 2 Week begins on Monday. Weekdays are numbered 1 through 7.

Field Summary

Modifier and TypeField and Description
private static final NumberEval
private WeekFields
public static final FreeRefFunction
private WeekFields
private WeekFields
private WeekFields
private WeekFields
private WeekFields
private static final HashSet<Integer>
private WeekFields

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ValueEval
evaluate(int srcRowIndex, int srcColumnIndex, ValueEval serialNumVE, ValueEval returnTypeVE)

Implements org.apache.poi.ss.formula.functions.Function2Arg.evaluate.

see Function#evaluate(ValueEval[], int, int)

public ValueEval
evaluate(ValueEval[]
the pre-evaluated arguments for this function. args is never null, nor are any of its elements.
args
,
OperationEvaluationContext
primarily used to identify the source cell containing the formula being evaluated. may also be used to dynamically create reference evals.
ec
)

Implements org.apache.poi.ss.formula.functions.FreeRefFunction.evaluate.

public int
getWeekNo(LocalDate date, int weekStartOn)

Inherited from org.apache.poi.ss.formula.functions.Fixed2ArgFunction:
evaluate

Field Detail

DEFAULT_RETURN_TYPEback to summary
private static final NumberEval DEFAULT_RETURN_TYPE
FRIDAY_STARTback to summary
private WeekFields FRIDAY_START
instanceback to summary
public static final FreeRefFunction instance
MONDAY_STARTback to summary
private WeekFields MONDAY_START
SATURDAY_STARTback to summary
private WeekFields SATURDAY_START
SUNDAY_STARTback to summary
private WeekFields SUNDAY_START
THURSDAY_STARTback to summary
private WeekFields THURSDAY_START
TUESDAY_STARTback to summary
private WeekFields TUESDAY_START
VALID_RETURN_TYPESback to summary
private static final HashSet<Integer> VALID_RETURN_TYPES
WEDNESDAY_STARTback to summary
private WeekFields WEDNESDAY_START

Constructor Detail

WeekNumback to summary
public WeekNum()

Method Detail

evaluateback to summary
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval serialNumVE, ValueEval returnTypeVE)

Implements org.apache.poi.ss.formula.functions.Function2Arg.evaluate.

Doc from org.apache.poi.ss.formula.functions.Function2Arg.evaluate.

see Function#evaluate(ValueEval[], int, int)

Annotations
@Override
evaluateback to summary
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec)

Implements org.apache.poi.ss.formula.functions.FreeRefFunction.evaluate.

Parameters
args:ValueEval[]

Doc from org.apache.poi.ss.formula.functions.FreeRefFunction.evaluate.

the pre-evaluated arguments for this function. args is never null, nor are any of its elements.

ec:OperationEvaluationContext

Doc from org.apache.poi.ss.formula.functions.FreeRefFunction.evaluate.

primarily used to identify the source cell containing the formula being evaluated. may also be used to dynamically create reference evals.

Returns:ValueEval

Doc from org.apache.poi.ss.formula.functions.FreeRefFunction.evaluate.

never null. Possibly an instance of ErrorEval in the case of a specified Excel error (Exceptions are never thrown to represent Excel errors).

Annotations
@Override
getWeekNoback to summary
public int getWeekNo(LocalDate date, int weekStartOn)