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

Defines 1 class

Week:: (10 methods):
  number()
  isoWeekNumber()
  day()
  validateStyle()
  dow0Becomes7()
  apparentBug()
  validateDateValue()
  validateMethod()
  buggyWeekNum1900()
  buggyWeekNum1904()


Class: Week  - X-Ref

number($dateValue, $method = Constants::STARTWEEK_SUNDAY)   X-Ref
WEEKNUM.

Returns the week of the year for a specified date.
The WEEKNUM function considers the week containing January 1 to be the first week of the year.
However, there is a European standard that defines the first week as the one with the majority
of days (four or more) falling in the new year. This means that for years in which there are
three days or less in the first week of January, the WEEKNUM function returns week numbers
that are incorrect according to the European standard.

Excel Function:
WEEKNUM(dateValue[,style])

return: int|string Week Number
param: mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
param: int $method Week begins on Sunday or Monday

isoWeekNumber($dateValue)   X-Ref
ISOWEEKNUM.

Returns the ISO 8601 week number of the year for a specified date.

Excel Function:
ISOWEEKNUM(dateValue)

return: int|string Week Number
param: mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),

day($dateValue, $style = 1)   X-Ref
WEEKDAY.

Returns the day of the week for a specified date. The day is given as an integer
ranging from 0 to 7 (dependent on the requested style).

Excel Function:
WEEKDAY(dateValue[,style])

return: int|string Day of the week value
param: null|float|int|string $dateValue Excel date serial value (float), PHP date timestamp (integer),
param: mixed $style A number that determines the type of return value

validateStyle($style)   X-Ref

param: mixed $style expect int

dow0Becomes7(int $DoW)   X-Ref
No description

apparentBug($dateValue)   X-Ref

param: mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),

validateDateValue($dateValue)   X-Ref
Validate dateValue parameter.

param: mixed $dateValue

validateMethod($method)   X-Ref
Validate method parameter.

param: mixed $method

buggyWeekNum1900(int $method)   X-Ref
No description

buggyWeekNum1904(int $method, bool $origNull, DateTime $dateObject)   X-Ref
No description