1--TEST-- 2IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject() 3--SKIPIF-- 4<?php 5if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> 6<?php if (version_compare(INTL_ICU_VERSION, '54.1') < 0) die('skip for ICU >= 54.1'); ?> 7<?php if (version_compare(INTL_ICU_VERSION, '58.1') >= 0) die('skip for ICU <= 57.1'); ?> 8--FILE-- 9<?php 10ini_set("intl.error_level", E_WARNING); 11ini_set("intl.default_locale", "pt_PT"); 12ini_set("date.timezone", 'Atlantic/Azores'); 13 14$ts = strtotime('2012-01-01 00:00:00 UTC'); 15 16function d(IntlDateFormatter $df) { 17global $ts; 18echo $df->format($ts), "\n"; 19var_dump($df->getCalendar(), 20$df->getCalendarObject()->getType(), 21$df->getCalendarObject()->getTimeZone()->getId()); 22echo "\n"; 23} 24 25$df = new IntlDateFormatter('fr@calendar=islamic', 0, 0, 'Europe/Minsk'); 26d($df); 27 28 29//changing the calendar with a cal type should not change tz 30$df->setCalendar(IntlDateFormatter::TRADITIONAL); 31d($df); 32 33//but changing with an actual calendar should 34$cal = IntlCalendar::createInstance("UTC"); 35$df->setCalendar($cal); 36d($df); 37 38?> 39--EXPECT-- 40dimanche 1 janvier 2012 ap. J.-C. à 03:00:00 heure de Kaliningrad 41int(1) 42string(9) "gregorian" 43string(12) "Europe/Minsk" 44 45dimanche 8 safar 1433 AH à 03:00:00 heure de Kaliningrad 46int(0) 47string(7) "islamic" 48string(12) "Europe/Minsk" 49 50dimanche 1 janvier 2012 ap. J.-C. à 00:00:00 UTC 51bool(false) 52string(9) "gregorian" 53string(3) "UTC" 54 55