Week
in package
uses
ArrayEnabled
Table of Contents
Properties
Methods
- day() : array<string|int, mixed>|int|string
- WEEKDAY.
- isoWeekNumber() : array<string|int, mixed>|int|string
- ISOWEEKNUM.
- number() : array<string|int, mixed>|int|string
- WEEKNUM.
- evaluateArrayArguments() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.
- evaluateArrayArgumentsIgnore() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.
- evaluateArrayArgumentsSubset() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.
- evaluateArrayArgumentsSubsetFrom() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.
- evaluateSingleArgumentArray() : array<string|int, mixed>
- Handles array argument processing when the function accepts a single argument that can be an array argument.
- apparentBug() : bool
- buggyWeekNum1900() : bool
- buggyWeekNum1904() : bool
- dow0Becomes7() : int
- initialiseHelper() : void
- testFalse() : bool
- validateDateValue() : float
- Validate dateValue parameter.
- validateMethod() : int
- Validate method parameter.
- validateStyle() : int
Properties
$arrayArgumentHelper
private
static ArrayArgumentHelper
$arrayArgumentHelper
$initializationNeeded
private
static bool
$initializationNeeded
= true
Methods
day()
WEEKDAY.
public
static day(null|array<string|int, mixed>|bool|float|int|string $dateValue[, mixed $style = 1 ]) : array<string|int, mixed>|int|string
Returns the day of the week for a specified date. The day is given as an integer ranging from 0 to 7 (dependent on the requested style).
Excel Function: WEEKDAY(dateValue[,style])
Parameters
- $dateValue : null|array<string|int, mixed>|bool|float|int|string
-
Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string Or can be an array of date values
- $style : mixed = 1
-
A number that determines the type of return value 1 or omitted Numbers 1 (Sunday) through 7 (Saturday). 2 Numbers 1 (Monday) through 7 (Sunday). 3 Numbers 0 (Monday) through 6 (Sunday). Or can be an array of styles
Return values
array<string|int, mixed>|int|string —Day of the week value If an array of values is passed as the argument, then the returned result will also be an array with the same dimensions
isoWeekNumber()
ISOWEEKNUM.
public
static isoWeekNumber(mixed $dateValue) : array<string|int, mixed>|int|string
Returns the ISO 8601 week number of the year for a specified date.
Excel Function: ISOWEEKNUM(dateValue)
Parameters
- $dateValue : mixed
-
Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string Or can be an array of date values
Return values
array<string|int, mixed>|int|string —Week Number If an array of numbers is passed as the argument, then the returned result will also be an array with the same dimensions
number()
WEEKNUM.
public
static number(mixed $dateValue[, array<string|int, mixed>|int $method = Constants::STARTWEEK_SUNDAY ]) : array<string|int, mixed>|int|string
Returns the week of the year for a specified date. The WEEKNUM function considers the week containing January 1 to be the first week of the year. However, there is a European standard that defines the first week as the one with the majority of days (four or more) falling in the new year. This means that for years in which there are three days or less in the first week of January, the WEEKNUM function returns week numbers that are incorrect according to the European standard.
Excel Function: WEEKNUM(dateValue[,style])
Parameters
- $dateValue : mixed
-
Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string Or can be an array of date values
- $method : array<string|int, mixed>|int = Constants::STARTWEEK_SUNDAY
-
Week begins on Sunday or Monday 1 or omitted Week begins on Sunday. 2 Week begins on Monday. 11 Week begins on Monday. 12 Week begins on Tuesday. 13 Week begins on Wednesday. 14 Week begins on Thursday. 15 Week begins on Friday. 16 Week begins on Saturday. 17 Week begins on Sunday. 21 ISO (Jan. 4 is week 1, begins on Monday). Or can be an array of methods
Return values
array<string|int, mixed>|int|string —Week Number If an array of values is passed as the argument, then the returned result will also be an array with the same dimensions
evaluateArrayArguments()
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.
protected
static evaluateArrayArguments(callable $method, mixed ...$arguments) : array<string|int, mixed>
Example use for: ROUND() or DATE().
Parameters
- $method : callable
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsIgnore()
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.
protected
static evaluateArrayArgumentsIgnore(callable $method, int $ignore, mixed ...$arguments) : array<string|int, mixed>
Example use for: HLOOKUP() and VLOOKUP(), where argument 1 is a matrix that needs to be treated as a database rather than as an array argument.
Parameters
- $method : callable
- $ignore : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsSubset()
Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.
protected
static evaluateArrayArgumentsSubset(callable $method, int $limit, mixed ...$arguments) : array<string|int, mixed>
Example use for: NETWORKDAYS() or CONCATENATE(), where the last argument is a matrix (or a series of values) that need to be treated as a such rather than as an array arguments.
Parameters
- $method : callable
- $limit : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsSubsetFrom()
Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.
protected
static evaluateArrayArgumentsSubsetFrom(callable $method, int $start, mixed ...$arguments) : array<string|int, mixed>
Example use for: Z.TEST() or INDEX(), where the first argument 1 is a matrix that needs to be treated as a dataset rather than as an array argument.
Parameters
- $method : callable
- $start : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateSingleArgumentArray()
Handles array argument processing when the function accepts a single argument that can be an array argument.
protected
static evaluateSingleArgumentArray(callable $method, array<string|int, mixed> $values) : array<string|int, mixed>
Example use for: DAYOFMONTH() or FACT().
Parameters
- $method : callable
- $values : array<string|int, mixed>
Return values
array<string|int, mixed>apparentBug()
private
static apparentBug(mixed $dateValue) : bool
Parameters
- $dateValue : mixed
-
Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
Return values
boolbuggyWeekNum1900()
private
static buggyWeekNum1900(int $method) : bool
Parameters
- $method : int
Return values
boolbuggyWeekNum1904()
private
static buggyWeekNum1904(int $method, bool $origNull, DateTime $dateObject) : bool
Parameters
- $method : int
- $origNull : bool
- $dateObject : DateTime
Return values
booldow0Becomes7()
private
static dow0Becomes7(int $DoW) : int
Parameters
- $DoW : int
Return values
intinitialiseHelper()
private
static initialiseHelper(array<string|int, mixed>|false $arguments) : void
Parameters
- $arguments : array<string|int, mixed>|false
-
Can be changed to array for Php8.1+
testFalse()
private
static testFalse(mixed $value) : bool
Parameters
- $value : mixed
Return values
boolvalidateDateValue()
Validate dateValue parameter.
private
static validateDateValue(mixed $dateValue) : float
Parameters
- $dateValue : mixed
Return values
floatvalidateMethod()
Validate method parameter.
private
static validateMethod(mixed $method) : int
Parameters
- $method : mixed
Return values
intvalidateStyle()
private
static validateStyle(mixed $style) : int
Parameters
- $style : mixed
-
expect int