DayOfWeek
: int
in package
Represents a civil day of week.
Integer values follow PHP's date('w') convention: Sunday is 0 and Saturday is 6.
Table of Contents
Cases
- Friday = 5
- Friday.
- Monday = 1
- Monday.
- Saturday = 6
- Saturday.
- Sunday = 0
- Sunday.
- Thursday = 4
- Thursday.
- Tuesday = 2
- Tuesday.
- Wednesday = 3
- Wednesday.
Methods
- countOccurrences() : int
- Counts occurrences of this day of week in an inclusive Julian Day Number range.
- daysSince() : int
- Returns the number of days from this day of week to a past occurrence of another day of week.
- daysUntil() : int
- Returns the number of days from this day of week to a future occurrence of another day of week.
- fromJDN() : self
- Returns the day of week for a Julian Day Number.
- weeksSpanned() : int
- Returns the number of weeks spanned by a day count starting from this day of week.
Cases
Sunday
Sunday.
Monday
Monday.
Tuesday
Tuesday.
Wednesday
Wednesday.
Thursday
Thursday.
Friday
Friday.
Saturday
Saturday.
Methods
countOccurrences()
Counts occurrences of this day of week in an inclusive Julian Day Number range.
public
countOccurrences(int $startJDN, int $endJDN) : int
Parameters
- $startJDN : int
-
Inclusive start Julian Day Number.
- $endJDN : int
-
Inclusive end Julian Day Number.
Tags
Return values
int —Number of matching days of week in the range.
daysSince()
Returns the number of days from this day of week to a past occurrence of another day of week.
public
daysSince(self $dayOfWeek[, int $occurrence = 1 ]) : int
Parameters
- $dayOfWeek : self
-
Target day of week to look back to.
- $occurrence : int = 1
-
Which occurrence of the target day of week.
Tags
Return values
int —Number of days since the requested occurrence.
daysUntil()
Returns the number of days from this day of week to a future occurrence of another day of week.
public
daysUntil(self $dayOfWeek[, int $occurrence = 1 ]) : int
Parameters
- $dayOfWeek : self
-
Target day of week to look forward to.
- $occurrence : int = 1
-
Which occurrence of the target day of week.
Tags
Return values
int —Number of days to the requested occurrence.
fromJDN()
Returns the day of week for a Julian Day Number.
public
static fromJDN(int $jdn) : self
Parameters
- $jdn : int
-
Julian Day Number.
Return values
self —Day of week for the given Julian Day Number.
weeksSpanned()
Returns the number of weeks spanned by a day count starting from this day of week.
public
weeksSpanned(int $days, self $firstDayOfWeek) : int
Parameters
- $days : int
-
The number of days in the span, starting from this day of week.
- $firstDayOfWeek : self
-
Day of week considered as the start of the week for counting purposes.
Tags
Return values
int —Number of weeks spanned by the day count.