IntlCalendar::createInstance
(PHP 5.5.0, PECL >= 3.0.0a1)
IntlCalendar::createInstance — Crée un nouvel objet IntlCalendar
Description
$timeZone = NULL
   [, string $locale = NULL
  ]] )En fournissant un fuseau horaire, et une locale, cette méthode crée un objet IntlCalendar. Cette méthode factorielle peut retourner une sous-classe de la classe IntlCalendar.
Le calendrier créé représentera l'instance du temps au moment où il a été créé, basé suivant le temps du système. Les champs peuvent être vidés avec la méthode IntCalendar::clear() sans argument. Voir aussi la méthode IntlGregorianCalendar::__construct().
Liste de paramètres
- 
    
timeZone - 
     
Le fuseau horaire à utiliser.
- 
  
NULL, in which case the default timezone will be used, as specified in the ini setting date.timezone or through the function date_default_timezone_set() and as returned by date_default_timezone_get(). - 
  
An IntlTimeZone, which will be used directly.
 - 
  
A DateTimeZone. Its identifier will be extracted and an ICU timezone object will be created; the timezone will be backed by ICUʼs database, not PHPʼs.
 - 
  
A string, which should be a valid ICU timezone identifier. See IntlTimeZone::createTimeZoneIDEnumeration(). Raw offsets such as "GMT+08:30" are also accepted.
 
 - 
  
 - 
    
locale - 
     
Une locale à utiliser, ou
NULLpour utiliser la locale par défaut. 
Valeurs de retour
   L'instance de l'objet IntlCalendar créé,
   ou NULL si une erreur survient.
  
Exemples
Exemple #1 Exemple avec IntlCalendar::createInstance()
<?php
ini_set('intl.default_locale', 'es_ES');
ini_set('date.timezone', 'Europe/Madrid');
$cal = IntlCalendar::createInstance();
echo "Aucun argument\n";
var_dump(get_class($cal),
		IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL));
echo "\n";
echo "Fuseau horaire explicite\n";
$cal = IntlCalendar::createInstance(IntlTimeZone::getGMT());
var_dump(get_class($cal),
		IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL));
echo "\n";
echo "Locale explicite (avec le calendrier)\n";
$cal = IntlCalendar::createInstance(NULL, 'es_ES@calendar=persian');
var_dump(get_class($cal),
		IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL));L'exemple ci-dessus va afficher :
Aucun argument string(21) "IntlGregorianCalendar" string(68) "martes 18 de junio de 2013 14:11:02 Hora de verano de Europa Central" Fuseau horaire explicite string(21) "IntlGregorianCalendar" string(45) "martes 18 de junio de 2013 12:11:02 GMT+00:00" Locale explicite (avec le calendrier) string(12) "IntlCalendar" string(70) "martes 28 de Khordad de 1392 14:11:02 Hora de verano de Europa Central"
Voir aussi
- IntlGregorianCalendar::__construct()
 
