Open In App

PHP | IntlCalendar getActualMaximum() Function

Last Updated : 25 Sep, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

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


Similar Reads

PHP | IntlCalendar isWeekend() Function
The IntlCalendar::isWeekend() function is an inbuilt function in PHP which is used to check whether a given date/time is in the weekend or not. Syntax: Object oriented style bool IntlCalendar::isWeekend( float $date = NULL ) Procedural style bool intlcal_is_weekend( IntlCalendar $cal, float $date = NULL ) Parameters: This function uses two paramete
1 min read
PHP | IntlCalendar roll() Function
The IntlCalendar::roll() function is an inbuilt function in PHP which is used to add value to field without carrying into more significant fields. The difference between IntlCalendar::roll() and IntlCalendar::add() function is that, the field value of IntlCalendar::roll() function overflow, it does not carry into more significant fields.Syntax: Obj
2 min read
PHP | IntlCalendar set() Function
The IntlCalendar::set() function is an inbuilt function in PHP which is used to set the time field or several common fields at once. The range of field value depends on the calendar. This function can not be called with exactly four parameters. Syntax: Object oriented style bool IntlCalendar::set( int $field, int $value ) or bool IntlCalendar::set(
2 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: This parameter holds the IntlCalendar resource.$fi
2 min read
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
1 min read
PHP | IntlCalendar before() Function
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 th
1 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 any value. Below program illustrates the IntlCalen
1 min read
PHP | IntlCalendar createInstance() Function
The IntlCalendar::createInstance() function is an inbuilt function in PHP which is used to create an instance of IntlCalendar. Syntax: Object oriented style: IntlCalendar IntlCalendar::createInstance( mixed $timeZone = NULL, string $locale = "" ) Procedural style: IntlCalendar intlcal_create_instance( mixed $timeZone = NULL, string $locale = "" ) P
2 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 ) Procedural style: bool intlcal_equals( IntlCalendar $cal
2 min read
PHP | IntlCalendar fieldDifference() Function
The IntlCalendar::fieldDifference() function is an inbuilt function in PHP which is used to return the difference between given time and the object time. Syntax: Object oriented style: int IntlCalendar::fieldDifference( float $when, int $field ) Procedural style: int intlcal_field_difference( IntlCalendar $cal, float $when, int $field ) Parameters:
2 min read