Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 400 and 401]

(no description)

File Size: 307 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.

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

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

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

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.

param: mixed $number
return: float|int

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

param: mixed $number
return: float

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