dateCompare.php
Table of Contents
Functions
- dateCompare() : string
- Check if two partial dates match.
Functions
dateCompare()
Check if two partial dates match.
dateCompare([string|int|null $date1 = null ][, string|int|null $date2 = null ][, string|null $unitRangeStart = 'y' ][, string|null $unitRangeEnd = null ]) : string
DATE_COMPARE(date1, date2, unitRangeStart, unitRangeEnd) → bool returns bool (bool): true if the dates match, false otherwise All components of date1 and date2 as specified by the range will be compared. You can refer to the units as:
- y, year, years
- m, month, months
- d, day, days
- h, hour, hours
- i, minute, minutes
- s, second, seconds
- f, millisecond, milliseconds
Parameters
- $date1 : string|int|null = null
-
- numeric timestamp or ISO 8601 date time string
- $date2 : string|int|null = null
-
- numeric timestamp or ISO 8601 date time string
- $unitRangeStart : string|null = 'y'
-
- unit to start from, see below
- $unitRangeEnd : string|null = null
-
- unit to end with, leave out to only compare the component as specified by unitRangeStart. An error is raised if unitRangeEnd is a unit before unitRangeStart.