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: 278 lines (10 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])

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

isoWeekNumber($dateValue)   X-Ref
ISOWEEKNUM.

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

Excel Function:
ISOWEEKNUM(dateValue)

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

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])

param: null|array|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
return: array|int|string Day of the week 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