Tuesday, October 7, 2025
HomeLanguagesPHP | IntlCalendar after() Function

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 )

Parameters:

  • $cal: This parameter holds the IntlCalendar resource.
  • $other: This parameter holds the calendar whose time will be checked against the primary object’s time.

Return Value: This function returns True if the object time is after that of the passed object and False otherwise. 

Below program illustrates the IntlCalendar::after() 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::after() function
// and display result
var_dump($calendar1->after($calendar2));
var_dump($calendar2->after($calendar1));
 
// Use IntlCalendar::add() function to
// add month in date
$calendar1->add(IntlCalendar::FIELD_MONTH, 1);
 
// Use IntlCalendar::after() function
// and display result
var_dump($calendar1->after($calendar2));
var_dump($calendar2->after($calendar1));
         
?>


Output:

bool(false)
bool(false)
bool(true)
bool(false)

Reference: https://www.php.net/manual/en/intlcalendar.after.php

RELATED ARTICLES

Most Popular

Dominic
32340 POSTS0 COMMENTS
Milvus
86 POSTS0 COMMENTS
Nango Kala
6708 POSTS0 COMMENTS
Nicole Veronica
11872 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11936 POSTS0 COMMENTS
Shaida Kate Naidoo
6829 POSTS0 COMMENTS
Ted Musemwa
7090 POSTS0 COMMENTS
Thapelo Manthata
6780 POSTS0 COMMENTS
Umr Jansen
6784 POSTS0 COMMENTS