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: 120 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

YearFrac:: (3 methods):
  fraction()
  excelBug()
  method1()


Class: YearFrac  - X-Ref

fraction($startDate, $endDate, $method = 0)   X-Ref
YEARFRAC.

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

return: float|string fraction of the year, or a string containing an error
param: mixed $startDate Excel date serial value (float), PHP date timestamp (integer),
param: mixed $endDate Excel date serial value (float), PHP date timestamp (integer),
param: int $method Method used for the calculation

excelBug(float $sDate, $startDate, $endDate, int $method)   X-Ref
Excel 1900 calendar treats date argument of null as 1900-01-00. Really.

param: mixed $startDate
param: mixed $endDate

method1(float $startDate, float $endDate)   X-Ref
No description