Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

(no description)

File Size: 306 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: Helpers  - X-Ref

isLeapYear($year)   X-Ref
Identify if a year is a leap year or not.

return: bool TRUE if the year is a leap year, otherwise FALSE
param: int|string $year The year to test

getDateValue($dateValue, bool $allowBool = true)   X-Ref
getDateValue.

return: float Excel date/time serial value
param: mixed $dateValue

getTimeValue($timeValue)   X-Ref
No description

adjustDateByMonths($dateValue = 0, float $adjustmentMonths = 0)   X-Ref
No description

replaceIfEmpty(&$value, $altValue)   X-Ref
Help reduce perceived complexity of some tests.

param: mixed $value
param: mixed $altValue

adjustYear(string $testVal1, string $testVal2, string &$testVal3)   X-Ref
Adjust year in ambiguous situations.


returnIn3FormatsArray(array $dateArray, bool $noFrac = false)   X-Ref
Return result in one of three formats.

return: mixed

returnIn3FormatsFloat(float $excelDateValue)   X-Ref
Return result in one of three formats.

return: mixed

returnIn3FormatsObject(DateTime $PHPDateObject)   X-Ref
Return result in one of three formats.

return: mixed

baseDate()   X-Ref
No description

nullFalseTrueToNumber(&$number, bool $allowBool = true)   X-Ref
Many functions accept null/false/true argument treated as 0/0/1.

param: mixed $number

validateNumericNull($number)   X-Ref
Many functions accept null argument treated as 0.

return: float|int
param: mixed $number

validateNotNegative($number)   X-Ref
Many functions accept null/false/true argument treated as 0/0/1.

return: float
param: mixed $number

silly1900(DateTime $PHPDateObject, string $mod = '-1 day')   X-Ref
No description

dateParse(string $string)   X-Ref
No description

dateParseSucceeded(array $dateArray)   X-Ref
No description

forceArray($dateArray)   X-Ref
Despite documentation, date_parse probably never returns false.
Just in case, this routine helps guarantee it.

param: array|false $dateArray