(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::getActualMaximum — The maximum value for a field, considering the objectʼs current time
Description
Style orienté objet
public
IntlCalendar::getActualMaximum(int
$field
): int|false
intlcal_get_actual_maximum(IntlCalendar
$calendar
, int
$field
): int|false
For instance, in the gregorian calendar, the actual maximum value for the
day of
month would vary between 28
and
31
, depending on the month and year of the current time.
Liste de paramètres
-
calendar
-
Une instance IntlCalendar.
-
field
-
Une constantes de champ
date/heure IntlCalendar. Ceux sont des valeurs entières
comprises entre 0
et
IntlCalendar::FIELD_COUNT
.
Valeurs de retour
An int representing the maximum value in the units associated
with the given field
ou false
si une erreur survient.
Exemples
Exemple #1 intlcalendar::getActualMaximum()
<?php
ini_set('date.timezone', 'Europe/Lisbon');
$cal = IntlCalendar::fromDateTime('2013-02-15');
var_dump($cal->getActualMaximum(IntlCalendar::FIELD_DAY_OF_MONTH)); //28
$cal->add(IntlCalendar::FIELD_EXTENDED_YEAR, -1);
var_dump($cal->getActualMaximum(IntlCalendar::FIELD_DAY_OF_MONTH)); //29
L'exemple ci-dessus va afficher :
int(28)
int(29)
Voir aussi
- intlcalendar::getMaximum() - Get the global maximum value for a field
- intlcalendar::getLeastMaximum() - Get the smallest local maximum for a field
- intlcalendar::getActualMinimum() - The minimum value for a field, considering the objectʼs current time