DateHelper
in package
FinalYes
Date Utility.
Table of Contents
Methods
- getDaysInMonth() : array<string|int, mixed>
- Get all dates for a given month.
- getWeekPeriod() : array<string|int, mixed>
- Get the start and end dates of the week for the specified year and month.
Methods
getDaysInMonth()
Get all dates for a given month.
public
static getDaysInMonth(int $year, int $month, string $format) : array<string|int, mixed>
Parameters
- $year : int
-
Year.
- $month : int
-
Month.
- $format : string
-
The format of the date retrieved.
Return values
array<string|int, mixed> —List of dates.
getWeekPeriod()
Get the start and end dates of the week for the specified year and month.
public
static getWeekPeriod(string $ym, int $nthWeek[, bool $aroundMonth = false ][, bool $startMonday = true ]) : array<string|int, mixed>
Parameters
- $ym : string
-
The target date. YYYYMM format.
- $nthWeek : int
-
Week number.
- $aroundMonth : bool = false
-
(optional) If true, calculate including the months before and after.
- $startMonday : bool = true
-
(optional) True if Monday is the first day of the week.
Return values
array<string|int, mixed> —Start and end dates of the week.