DateUtil
Class DateUtil is responsible for providing utilities applicable to Rules.
Table of Contents
Properties
- $leapBug : mixed
- $monthEndDoY365 : mixed
- $monthEndDoY366 : mixed
- $wDayMask : mixed
Methods
- getDateInfo() : DateInfo
- Get an object containing info for a particular date
- getDateTimeByDayOfYear() : mixed
- getDayOfWeek() : int
- Alias method to determine the day of the week from 0-6.
- getDayOfWeekAsText() : string
- Method to determine the day of the week from MO-SU.
- getDaySet() : DaySet
- getDaySetOfDay() : DaySet
- Get an array of DOY (Day of Year) for each day in a particular month.
- getDaySetOfMonth() : DaySet
- Get an array of DOY (Day of Year) for each day in a particular month.
- getDaySetOfWeek() : DaySet
- Get an array of DOY (Day of Year) for each day in a particular week.
- getDaySetOfYear() : DaySet
- Get an array of DOY (Day of Year) for each day in a particular year.
- getMonthDaysMask() : array<string|int, mixed>
- Get a reference array with the day number for each day of each month.
- getMonthMask() : mixed
- getTimeSet() : array<string|int, mixed>
- getTimeSetOfHour() : array<string|int, mixed>
- getTimeSetOfMinute() : array<string|int, mixed>
- getTimeSetOfSecond() : array<string|int, mixed>
- getYearLength() : int
- Get the number of days in a year.
- hasLeapYearBug() : mixed
- isLeapYear() : bool
- Alias method to determine if a year is a leap year.
- isLeapYearDate() : bool
- Alias method to determine if a date falls within a leap year.
- pymod() : int
- closure/goog/math/math.js:modulo Copyright 2006 The Closure Library Authors.
Properties
$leapBug
public
static mixed
$leapBug
= null
$monthEndDoY365
public
static mixed
$monthEndDoY365
= array(0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365)
$monthEndDoY366
public
static mixed
$monthEndDoY366
= array(0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366)
$wDayMask
public
static mixed
$wDayMask
= array(0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3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DateInfo()
Get an object containing info for a particular date
public
static getDateInfo(DateTimeInterface $dt) : DateInfo
Parameters
- $dt : DateTimeInterface
Return values
DateInfogetDateTimeByDayOfYear()
public
static getDateTimeByDayOfYear(mixed $dayOfYear, mixed $year, DateTimeZone $timezone) : mixed
Parameters
- $dayOfYear : mixed
- $year : mixed
- $timezone : DateTimeZone
getDayOfWeek()
Alias method to determine the day of the week from 0-6.
public
static getDayOfWeek(DateTimeInterface $dt) : int
0 = Monday 1 = Tuesday 2 = Wednesday 3 = Thursday 4 = Friday 5 = Saturday 6 = Sunday
Parameters
- $dt : DateTimeInterface
Return values
intgetDayOfWeekAsText()
Method to determine the day of the week from MO-SU.
public
static getDayOfWeekAsText(DateTimeInterface $dt) : string
MO = Monday TU = Tuesday WE = Wednesday TH = Thursday FR = Friday SA = Saturday SU = Sunday
Parameters
- $dt : DateTimeInterface
Return values
stringgetDaySet()
public
static getDaySet(Rule $rule, DateTimeInterface $dt, DateInfo $dtInfo, DateTimeInterface $start) : DaySet
Parameters
Return values
DaySetgetDaySetOfDay()
Get an array of DOY (Day of Year) for each day in a particular month.
public
static getDaySetOfDay(DateTimeInterface $dt) : DaySet
Parameters
- $dt : DateTimeInterface
-
The datetime
Return values
DaySetgetDaySetOfMonth()
Get an array of DOY (Day of Year) for each day in a particular month.
public
static getDaySetOfMonth(DateTimeInterface $dt) : DaySet
Parameters
- $dt : DateTimeInterface
-
The datetime
Return values
DaySetgetDaySetOfWeek()
Get an array of DOY (Day of Year) for each day in a particular week.
public
static getDaySetOfWeek(DateTimeInterface $dt, DateTimeInterface $start[, null|Rule $rule = null ][, null|DateInfo $dtInfo = null ]) : DaySet
Parameters
- $dt : DateTimeInterface
- $start : DateTimeInterface
- $rule : null|Rule = null
- $dtInfo : null|DateInfo = null
Return values
DaySetgetDaySetOfYear()
Get an array of DOY (Day of Year) for each day in a particular year.
public
static getDaySetOfYear(DateTimeInterface $dt) : DaySet
Parameters
- $dt : DateTimeInterface
-
The datetime
Return values
DaySetgetMonthDaysMask()
Get a reference array with the day number for each day of each month.
public
static getMonthDaysMask(DateTimeInterface $dt[, bool $negative = false ]) : array<string|int, mixed>
Parameters
- $dt : DateTimeInterface
-
The datetime
- $negative : bool = false
Return values
array<string|int, mixed>getMonthMask()
public
static getMonthMask(DateTimeInterface $dt) : mixed
Parameters
- $dt : DateTimeInterface
getTimeSet()
public
static getTimeSet(Rule $rule, DateTimeInterface $dt) : array<string|int, mixed>
Parameters
- $rule : Rule
- $dt : DateTimeInterface
Return values
array<string|int, mixed>getTimeSetOfHour()
public
static getTimeSetOfHour(Rule $rule, DateTimeInterface $dt) : array<string|int, mixed>
Parameters
- $rule : Rule
- $dt : DateTimeInterface
Return values
array<string|int, mixed>getTimeSetOfMinute()
public
static getTimeSetOfMinute(Rule $rule, DateTimeInterface $dt) : array<string|int, mixed>
Parameters
- $rule : Rule
- $dt : DateTimeInterface
Return values
array<string|int, mixed>getTimeSetOfSecond()
public
static getTimeSetOfSecond(DateTimeInterface $dt) : array<string|int, mixed>
Parameters
- $dt : DateTimeInterface
Return values
array<string|int, mixed>getYearLength()
Get the number of days in a year.
public
static getYearLength(DateTimeInterface $dt) : int
Parameters
- $dt : DateTimeInterface
Return values
inthasLeapYearBug()
public
static hasLeapYearBug() : mixed
isLeapYear()
Alias method to determine if a year is a leap year.
public
static isLeapYear(int $year) : bool
Parameters
- $year : int
Return values
boolisLeapYearDate()
Alias method to determine if a date falls within a leap year.
public
static isLeapYearDate(DateTimeInterface $dt) : bool
Parameters
- $dt : DateTimeInterface
Return values
boolpymod()
closure/goog/math/math.js:modulo Copyright 2006 The Closure Library Authors.
public
static pymod(int $a, int $b) : int
The % operator in PHP returns the remainder of a / b, but differs from some other languages in that the result will have the same sign as the dividend. For example, -1 % 8 == -1, whereas in some other languages (such as Python) the result would be 7. This function emulates the more correct modulo behavior, which is useful for certain applications such as calculating an offset index in a circular list.
Parameters
- $a : int
-
The dividend.
- $b : int
-
The divisor.
Return values
int —$a % $b where the result is between 0 and $b (either 0 <= x < $b or $b < x <= 0, depending on the sign of $b).