Documentation

YearFrac
in package
uses ArrayEnabled

Table of Contents

Properties

$arrayArgumentHelper  : ArrayArgumentHelper
$initializationNeeded  : bool

Methods

fraction()  : array<string|int, mixed>|float|int|string
YEARFRAC.
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.
excelBug()  : float
Excel 1900 calendar treats date argument of null as 1900-01-00. Really.
initialiseHelper()  : void
method1()  : float
testFalse()  : bool

Properties

$initializationNeeded

private static bool $initializationNeeded = true

Methods

fraction()

YEARFRAC.

public static fraction(mixed $startDate, mixed $endDate[, array<string|int, mixed>|int $method = 0 ]) : array<string|int, mixed>|float|int|string

Calculates the fraction of the year represented by the number of whole days between two dates (the start_date and the end_date). Use the YEARFRAC worksheet function to identify the proportion of a whole year's benefits or obligations to assign to a specific term.

Excel Function: YEARFRAC(startDate,endDate[,method]) See https://lists.oasis-open.org/archives/office-formula/200806/msg00039.html for description of algorithm used in Excel

Parameters
$startDate : mixed

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string Or can be an array of values

$endDate : mixed

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string Or can be an array of methods

$method : array<string|int, mixed>|int = 0

Method used for the calculation 0 or omitted US (NASD) 30/360 1 Actual/actual 2 Actual/360 3 Actual/365 4 European 30/360 Or can be an array of methods

Return values
array<string|int, mixed>|float|int|string

fraction of the year, or a string containing an error If an array of values is passed for the $startDate or $endDays,arguments, then the returned result will also be an array with matching 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>

excelBug()

Excel 1900 calendar treats date argument of null as 1900-01-00. Really.

private static excelBug(float $sDate, mixed $startDate, mixed $endDate, int $method) : float
Parameters
$sDate : float
$startDate : mixed
$endDate : mixed
$method : int
Return values
float

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+

method1()

private static method1(float $startDate, float $endDate) : float
Parameters
$startDate : float
$endDate : float
Return values
float

testFalse()

private static testFalse(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

        
On this page

Search results