DateFunction
class DateFunction
This class provides some date functions for the expression parser.
Properties
static mixed|null | $dateFormat | ||
static mixed|null | $timezone |
Methods
Returns the date corresponding of the nth day of a month
Returns the last day of the month
Returns a new date corresponding to the first day of the month of the given date.
Returns a new date corresponding to the last day of the month of the given date.
Parses a date string to the given format and converts it to a DateTime object
Checks if a date string match a given format
function makeDate
function isDate
function getMonthNames
function init
Details
at line 70
static DateTime
nthDayOfMonth(int $nth, int $day, int $month, int $year)
Returns the date corresponding of the nth day of a month
Ex: nthDayOfMonth(1, 0, 1, 2017) for the question: what is the first sunday of January 2017
at line 89
static int
lastDay(int $month, int $year)
Returns the last day of the month
Ex: lastDay(2, 2017) returns 28.
at line 104
static DateTime
firstDayOfMonth(DateTime $dateObj)
Returns a new date corresponding to the first day of the month of the given date.
at line 119
static DateTime
lastDayOfMonth(DateTime $dateObj)
Returns a new date corresponding to the last day of the month of the given date.
at line 135
static DateTime
addMonths(int $months, DateTime $dateObject)
Returns a new date from the input date by adding the given number of months
at line 158
static DateTime|null
parseDate(string $format, string $dateStr)
Parses a date string to the given format and converts it to a DateTime object
at line 181
static bool
hasFormat(string $format, string $dateStr)
Checks if a date string match a given format
at line 203
static mixed
makeDate(mixed $value)
function makeDate
at line 224
static bool
isDate(mixed $dateStr)
function isDate
determines if date is true
at line 240
static mixed
getMonthNames(mixed $locale = null)
function getMonthNames
get the value of monthNames
at line 266
static protected void
init()
function init