PHP - Manual: IntlCalendar::after
2024-11-13
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::after — Whether this objectʼs time is after that of the passed object
面向对象风格
过程化风格
Returns whether this objectʼs time succeeds the argumentʼs time.
calendar
IntlCalendar 实例。
other
The calendar whose time will be checked against the primary objectʼs time.
Returns true
if this objectʼs current time is after that of the
calendar
argumentʼs time. Returns false
otherwise.
On failure false
is also returned. To detect error conditions use intl_get_error_code(), or set up Intl to throw exceptions.
示例 #1 IntlCalendar::after()
<?php
$cal1 = IntlCalendar::createInstance();
$cal2 = clone $cal1;
var_dump($cal1->after($cal2), //false
$cal2->after($cal1)); //false
$cal1->roll(IntlCalendar::FIELD_MILLISECOND, true);
var_dump($cal1->after($cal2), //true
$cal2->after($cal1)); //false