PHP | IntlCalendar before() Function Last Updated : 29 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The IntlCalendar::before() function is an inbuilt function in PHP which returns True if the object current time is before that of the passed object. Syntax: Object oriented style: bool IntlCalendar::before( IntlCalendar $other ) Procedural style: bool intlcal_before( IntlCalendar $cal, IntlCalendar $other ) Parameters: $cal: This parameter holds the IntlCalendar resource. $other: This parameter holds the calendar whose time checked against the primary object time. Return Value: This function returns TRUE if the object current time is before that of the passed object. Below program illustrates the IntlCalendar::before() function in PHP: Program: php <?php // Create an IntlCalendar from a DateTime object or string $calendar1 = IntlCalendar::fromDateTime('2019-08-29 09:19:29'); // Clone the Calendar date $calendar2 = clone $calendar1; // Use IntlCalendar::before() function // and display result var_dump($calendar1->before($calendar2)); var_dump($calendar2->before($calendar1)); // Use IntlCalendar::add() function to // add month in date $calendar1->add(IntlCalendar::FIELD_MONTH, 1); // Use IntlCalendar::before() function // and display result var_dump($calendar1->before($calendar2)); var_dump($calendar2->before($calendar1)); ?> Output: bool(false) bool(false) bool(false) bool(true) Reference: https://www.php.net/manual/en/intlcalendar.before.php Comment More infoAdvertise with us Next Article PHP | IntlCalendar before() Function J jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Intl Similar Reads PHP | IntlCalendar after() Function The IntlCalendar::after() function is an inbuilt function in PHP which returns True if the object time is after that of the passed object. Syntax: Object oriented style:bool IntlCalendar::after( IntlCalendar $other )Procedural style:bool intlcal_after( IntlCalendar $cal, IntlCalendar $other ) Parame 1 min read PHP | IntlCalendar add() Function The IntlCalendar::add() function is an inbuilt function in PHP which is used to add a signed amount of time to a field. Syntax: Object oriented style: bool IntlCalendar::add( int $field, int $amount ) Procedural style: bool intlcal_add( IntlCalendar $cal, int $field, int $amount ) Parameters: $cal: 2 min read PHP | IntlCalendar::__construct() Function The IntlCalendar::__construct() function is an inbuilt function in PHP which is used to create a private constructor for disallowing instantiation. Syntax: private IntlCalendar::__construct( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return 1 min read PHP | IntlCalendar equals() Function The IntlCalendar::equals() function is an inbuilt function in PHP which is used to compare two IntlCalendar time objects and returns true if this calendar and given calendar have same date otherwise returns false. Syntax: Object oriented style: bool IntlCalendar::equals( IntlCalendar $other ) Proced 2 min read PHP | IntlCalendar fromDateTime() Function The IntlCalendar::fromDateTime() function is an inbuilt function in PHP which is used to create an IntlCalendar from a DateTime object or string. The value of new calendar represents the same instant as the DateTime and timezone. Syntax: Object oriented style IntlCalendar IntlCalendar::fromDateTime( 2 min read Like