Helpers
in package
Table of Contents
Methods
- adjustDateByMonths() : DateTime
- Adjust date by given months.
- adjustYear() : void
- Adjust year in ambiguous situations.
- dateParse() : array<string|int, mixed>
- dateParseSucceeded() : bool
- getDateValue() : float
- getDateValue.
- getTimeValue() : float|string
- getTimeValue.
- isLeapYear() : bool
- Identify if a year is a leap year or not.
- nullFalseTrueToNumber() : void
- Many functions accept null/false/true argument treated as 0/0/1.
- replaceIfEmpty() : void
- Help reduce perceived complexity of some tests.
- returnIn3FormatsArray() : DateTime|float|int
- Return result in one of three formats.
- returnIn3FormatsFloat() : float|int|DateTime
- Return result in one of three formats.
- returnIn3FormatsObject() : DateTime|float|int
- Return result in one of three formats.
- silly1900() : void
- validateNotNegative() : float
- Many functions accept null/false/true argument treated as 0/0/1.
- validateNumericNull() : int|float
- Many functions accept null argument treated as 0.
- baseDate() : int
- forceArray() : array<string|int, mixed>
- Despite documentation, date_parse probably never returns false.
Methods
adjustDateByMonths()
Adjust date by given months.
public
static adjustDateByMonths([mixed $dateValue = 0 ][, float $adjustmentMonths = 0 ]) : DateTime
Parameters
- $dateValue : mixed = 0
- $adjustmentMonths : float = 0
Return values
DateTimeadjustYear()
Adjust year in ambiguous situations.
public
static adjustYear(string $testVal1, string $testVal2, string &$testVal3) : void
Parameters
- $testVal1 : string
- $testVal2 : string
- $testVal3 : string
dateParse()
public
static dateParse(string $string) : array<string|int, mixed>
Parameters
- $string : string
Return values
array<string|int, mixed>dateParseSucceeded()
public
static dateParseSucceeded(array<string|int, mixed> $dateArray) : bool
Parameters
- $dateArray : array<string|int, mixed>
Return values
boolgetDateValue()
getDateValue.
public
static getDateValue(mixed $dateValue[, bool $allowBool = true ]) : float
Parameters
- $dateValue : mixed
- $allowBool : bool = true
Return values
float —Excel date/time serial value
getTimeValue()
getTimeValue.
public
static getTimeValue(string $timeValue) : float|string
Parameters
- $timeValue : string
Return values
float|string —Excel date/time serial value, or string if error
isLeapYear()
Identify if a year is a leap year or not.
public
static isLeapYear(int|string $year) : bool
Parameters
- $year : int|string
-
The year to test
Return values
bool —TRUE if the year is a leap year, otherwise FALSE
nullFalseTrueToNumber()
Many functions accept null/false/true argument treated as 0/0/1.
public
static nullFalseTrueToNumber(mixed &$number[, bool $allowBool = true ]) : void
Parameters
- $number : mixed
- $allowBool : bool = true
replaceIfEmpty()
Help reduce perceived complexity of some tests.
public
static replaceIfEmpty(mixed &$value, mixed $altValue) : void
Parameters
- $value : mixed
- $altValue : mixed
returnIn3FormatsArray()
Return result in one of three formats.
public
static returnIn3FormatsArray(array<string|int, mixed> $dateArray[, bool $noFrac = false ]) : DateTime|float|int
Parameters
- $dateArray : array<string|int, mixed>
- $noFrac : bool = false
Return values
DateTime|float|intreturnIn3FormatsFloat()
Return result in one of three formats.
public
static returnIn3FormatsFloat(float $excelDateValue) : float|int|DateTime
Parameters
- $excelDateValue : float
Return values
float|int|DateTimereturnIn3FormatsObject()
Return result in one of three formats.
public
static returnIn3FormatsObject(DateTime $PHPDateObject) : DateTime|float|int
Parameters
- $PHPDateObject : DateTime
Return values
DateTime|float|intsilly1900()
public
static silly1900(DateTime $PHPDateObject[, string $mod = '-1 day' ]) : void
Parameters
- $PHPDateObject : DateTime
- $mod : string = '-1 day'
validateNotNegative()
Many functions accept null/false/true argument treated as 0/0/1.
public
static validateNotNegative(mixed $number) : float
Parameters
- $number : mixed
Tags
Return values
floatvalidateNumericNull()
Many functions accept null argument treated as 0.
public
static validateNumericNull(mixed $number) : int|float
Parameters
- $number : mixed
Return values
int|floatbaseDate()
private
static baseDate() : int
Return values
intforceArray()
Despite documentation, date_parse probably never returns false.
private
static forceArray(array<string|int, mixed>|false $dateArray) : array<string|int, mixed>
Just in case, this routine helps guarantee it.
Parameters
- $dateArray : array<string|int, mixed>|false