IntlDateFormatter::setCalendar
datefmt_set_calendar
(PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
IntlDateFormatter::setCalendar -- datefmt_set_calendar — Définit le calendrier utilisé par le formatteur
Description
Style orienté objet
bool IntlDateFormatter::setCalendar
( int
$which
)Style procédural
Configure le calendrier à utiliser.
Liste de paramètres
-
fmt -
La ressource de formateur IntlDateFormatter.
-
which -
Le calendrier à utiliser. Par défaut, c'est
IntlDateFormatter::GREGORIAN.
Valeurs de retour
Cette fonction retourne TRUE en cas de
succès ou FALSE si une erreur survient.
Exemples
Exemple #1 Exemple avec datefmt_set_calendar(), procédural
<?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 avec datefmt_set_calendar(), POO
<?php
$fmt = new IntlDateFormatter( "en_US" ,IntlDateFormatter::FULL,IntlDateFormatter::FULL,'America/Los_Angeles',IntlDateFormatter::GREGORIAN );
echo "calendar of the formatter is : ".$fmt->getCalendar();
$fmt->setCalendar(IntlDateFormatter::TRADITIONAL);
echo "Le calendrier est maintenant : ".$fmt->getCalendar();
?>
L'exemple ci-dessus va afficher :
Le calendrier du formateur est : 1 Le calendrier est maintenant : 0
Voir aussi
- datefmt_get_calendar() - Lit le calendrier utilisé par l'objet IntlDateFormatter
- datefmt_create() - Crée un formateur de date
There are no user contributed notes for this page.
