Thursday, September 4, 2025
HomeLanguagesPHP | IntlCalendar getActualMaximum() Function

PHP | IntlCalendar getActualMaximum() Function

The IntlCalendar::getActualMaximum() function is an inbuilt function in PHP which is used to return the field relative maximum value around the current time.

Syntax:

  • Object oriented style
    int IntlCalendar::getActualMaximum( int $field )
  • Procedural style
    int intlcal_get_actual_maximum( IntlCalendar $cal, int $field )

Parameters: This function uses two parameters as mentioned above and described below:

  • $cal: This parameter holds the resource of IntlCalendar.
  • $field: This parameter holds one of the IntlCalendar date/time field constants. This field contains an integer value lies between 0 to IntlCalendar::FIELD_COUNT.

Return Value: This function returns the integer value which represents the maximum value in the units associated with the given field on success or FALSE on failure.

Below program illustrates the IntlCalendar::getActualMaximum() function in PHP:

Program:




<?php
  
// Set the DateTime object
ini_set('date.timezone', 'Asia/Calcutta');
  
// Declare an IntlCalendar DateTime object
$calendar = IntlCalendar::fromDateTime('2010-09-22');
  
// Use getActualMaximum() function to the DateTime object
var_dump($calendar->getActualMaximum(IntlCalendar::FIELD_DAY_OF_MONTH));
  
// Use getActualMaximum() function to the DateTime object
var_dump($calendar->getActualMaximum(IntlCalendar::FIELD_DAY_OF_WEEK_IN_MONTH));
  
// Use getActualMaximum() function to the DateTime object
var_dump($calendar->getActualMaximum(IntlCalendar::FIELD_MONTH));
  
// Use getActualMaximum() function to the DateTime object
var_dump($calendar->getActualMaximum(IntlCalendar::FIELD_WEEK_OF_YEAR));
  
// Use getActualMaximum() function to the DateTime object
var_dump($calendar->getActualMaximum(IntlCalendar::FIELD_WEEK_OF_MONTH));
  
?>


Output:

int(30)
int(5)
int(11)
int(52)
int(5)

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

RELATED ARTICLES

Most Popular

Dominic
32260 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6625 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6747 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6694 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS