- Object Oriented Style:
bool IntlCalendar::before (IntlCalendar $other)
- Procedural style:
bool intlcal_before (IntlCalendar $cal, IntlCalendar $other)
- $cal:this parameter contains IntlCalendar resource.
- $other:this parameter contains a calendar that is checked against the time of the primary object.
// Create IntlCalendar from a DateTime object or string
$calendar1
= IntlCalendar::fromDateTime (
’2019-08-29 09: 19: 29’
);
// clone calendar date
$calendar2
=
clone
$calendar1
;
// Using the IntlCalendar::before() function
// and display the result
var_dump (
$calendar1
-> before (
$calendar2
));
var_dump (
$calendar2
-> before (
$calendar1
));
// Use the IntlCalendar::add() function for
// add month to date
$calendar1
-> add (IntlCalendar::FIELD_MONTH, 1);
// Using the IntlCalendar::before() function
// and display the result
var_dump (
$calendar1
-> before (
$calendar2
));
var_dump (
$calendar2
-> before (
$calendar1
));
?>
Exit:bool (false ) bool (false) bool (false) bool (true)
Link: https://www.php.net/manual/en/intlcalendar.before.php