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, '51.2') >= 0) die('skip for ICU < 51.2'); ?> 7--FILE-- 8<?php 9ini_set("intl.error_level", E_WARNING); 10ini_set("intl.default_locale", "pt_PT"); 11ini_set("date.timezone", 'Atlantic/Azores'); 12 13$ts = strtotime('2012-01-01 00:00:00 UTC'); 14 15function d(IntlDateFormatter $df) { 16global $ts; 17echo $df->format($ts), "\n"; 18var_dump($df->getCalendar(), 19$df->getCalendarObject()->getType(), 20$df->getCalendarObject()->getTimeZone()->getId()); 21echo "\n"; 22} 23 24$df = new IntlDateFormatter('fr@calendar=islamic', 0, 0, 'Europe/Minsk'); 25d($df); 26 27 28//changing the calendar with a cal type should not change tz 29$df->setCalendar(IntlDateFormatter::TRADITIONAL); 30d($df); 31 32//but changing with an actual calendar should 33$cal = IntlCalendar::createInstance("UTC"); 34$df->setCalendar($cal); 35d($df); 36 37?> 38==DONE== 39--EXPECT-- 40dimanche 1 janvier 2012 ap. J.-C. 03:00:00 UTC+03:00 41int(1) 42string(9) "gregorian" 43string(12) "Europe/Minsk" 44 45dimanche 8 Safar 1433 AH 03:00:00 UTC+03:00 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==DONE== 56