DateValue
in package
uses
ArrayEnabled
Table of Contents
Properties
Methods
- fromString() : array<string|int, mixed>|DateTime|float|int|string
- DATEVALUE.
- 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.
- finalResults() : DateTime|float|int|string
- Final results.
- initialiseHelper() : void
- setUpArray() : array<string|int, mixed>
- Parse date.
- t1ToString() : string
- testFalse() : bool
Properties
$arrayArgumentHelper
private
static ArrayArgumentHelper
$arrayArgumentHelper
$initializationNeeded
private
static bool
$initializationNeeded
= true
Methods
fromString()
DATEVALUE.
public
static fromString(null|array<string|int, mixed>|bool|float|int|string $dateValue) : array<string|int, mixed>|DateTime|float|int|string
Returns a value that represents a particular date. Use DATEVALUE to convert a date represented by a text string to an Excel or PHP date/time stamp value.
NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
Excel Function: DATEVALUE(dateValue)
Parameters
- $dateValue : null|array<string|int, mixed>|bool|float|int|string
-
Text that represents a date in a Microsoft Excel date format. For example, "1/30/2008" or "30-Jan-2008" are text strings within quotation marks that represent dates. Using the default date system in Excel for Windows, date_text must represent a date from January 1, 1900, to December 31, 9999. Using the default date system in Excel for the Macintosh, date_text must represent a date from January 1, 1904, to December 31, 9999. DATEVALUE returns the #VALUE! error value if date_text is out of this range. Or can be an array of date values
Return values
array<string|int, mixed>|DateTime|float|int|string —Excel date/time serial value, PHP date/time serial value or PHP date/time object, depending on the value of the ReturnDateType flag If an array of numbers 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>finalResults()
Final results.
private
static finalResults(array<string|int, mixed> $PHPDateArray, DateTimeImmutable $dti, int $baseYear) : DateTime|float|int|string
Parameters
- $PHPDateArray : array<string|int, mixed>
- $dti : DateTimeImmutable
- $baseYear : int
Return values
DateTime|float|int|string —Excel date/time serial value, PHP date/time serial value or PHP date/time object, depending on the value of the ReturnDateType flag
initialiseHelper()
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+
setUpArray()
Parse date.
private
static setUpArray(string $dateValue, DateTimeImmutable $dti) : array<string|int, mixed>
Parameters
- $dateValue : string
- $dti : DateTimeImmutable
Return values
array<string|int, mixed>t1ToString()
private
static t1ToString(array<string|int, mixed> $t1, DateTimeImmutable $dti, bool $yearFound) : string
Parameters
- $t1 : array<string|int, mixed>
- $dti : DateTimeImmutable
- $yearFound : bool
Return values
stringtestFalse()
private
static testFalse(mixed $value) : bool
Parameters
- $value : mixed