array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'fr', ), 'this' => array ( 0 => 'intldateformatter.getcalendar.php', 1 => 'IntlDateFormatter::getCalendar', ), 'up' => array ( 0 => 'class.intldateformatter.php', 1 => 'IntlDateFormatter', ), 'prev' => array ( 0 => 'intldateformatter.formatobject.php', 1 => 'IntlDateFormatter::formatObject', ), 'next' => array ( 0 => 'intldateformatter.getdatetype.php', 1 => 'IntlDateFormatter::getDateType', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'fr', 'path' => 'reference/intl/dateformatter/get-calendar.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
IntlDateFormatter::getCalendar -- datefmt_get_calendar — Lit le calendrier utilisé par l'objet IntlDateFormatter
Style orienté objet
Style procédural
Le type
de calendrier utilisé par le formateur. Peut être soit la constante
IntlDateFormatter::TRADITIONAL
, soit la constante
IntlDateFormatter::GREGORIAN
.
Retourne false
en cas d'échec.
Exemple #1 Exemple avec datefmt_get_calendar()
<?php
$fmt = datefmt_create(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
echo 'Le calendrier du formateur est : ' . datefmt_get_calendar($fmt);
datefmt_set_calendar($fmt, IntlDateFormatter::TRADITIONAL);
echo 'Le calendrier est maintenant : ' . datefmt_get_calendar($fmt);
?>
Exemple #2 Exemple orienté objet
<?php
$fmt = new IntlDateFormatter(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
echo 'Le calendrier du formateur est : ' . $fmt->getCalendar();
$fmt->setCalendar(IntlDateFormatter::TRADITIONAL);
echo 'Le calendrier est maintenant : ' . $fmt->getCalendar();
?>
Exemple #3 Exemple de gestion de locale invalide
<?php
try {
$fmt = new IntlDateFormatter(
'locale_invalide',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'je_ne_sais_pas',
IntlDateFormatter::GREGORIAN,
);
} catch (\Error $e) {
// ...
}
?>
L'exemple ci-dessus va afficher :
Le calendrier du formateur est : 1 Le calendrier est maintenant : 0