The IntlCalendar::getLeastMaximum() function is an inbuilt function in PHP which is used to get the smallest local maximum for a field. The value should be smaller or equal to IntlCalendar::getActualMaxmimum() which is smaller or equal to IntlCalendar::getMaximum() return value.
Syntax:
- Object oriented style
int IntlCalendar::getLeastMaximum( int $field )
- Procedural style
int intlcal_get_least_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. The value of field constants are integer and lies between 0 to IntlCalendar::FIELD_COUNT.
Return Value: This function returns an integer value which represents a field value in the field unit on success or FALSE on failure.
Below program illustrates the IntlCalendar::getLeastMaximum() function in PHP:
Program:
<?php // Set the date timezone ini_set ( 'date.timezone' , 'Asia/Calcutta' ); ini_set ( 'intl.default_locale' , 'en_US' ); // Create a DateTime object $calendar = IntlCalendar::fromDateTime( '2019-03-21 09:19:29' ); var_dump( $calendar ->getLeastMaximum(IntlCalendar::FIELD_DAY_OF_MONTH), $calendar ->getActualMaximum(IntlCalendar::FIELD_DAY_OF_MONTH), $calendar ->getMaximum(IntlCalendar::FIELD_DAY_OF_MONTH), $calendar ->getLeastMaximum(IntlCalendar::FIELD_WEEK_OF_YEAR), $calendar ->getActualMaximum(IntlCalendar::FIELD_WEEK_OF_YEAR), $calendar ->getMaximum(IntlCalendar::FIELD_WEEK_OF_YEAR) ); ?> |
int(28) int(31) int(31) int(52) int(52) int(53)
Reference: https://www.php.net/manual/en/intlcalendar.getleastmaximum.php