1--TEST-- 2IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject() 3--EXTENSIONS-- 4intl 5--SKIPIF-- 6<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) die('skip for ICU >= 51.2 and < 52.1'); ?> 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--EXPECT-- 39dimanche 1 janvier 2012 ap. J.-C. 03:00:00 UTC+03:00 40int(1) 41string(9) "gregorian" 42string(12) "Europe/Minsk" 43 44dimanche 8 safar 1433 AH 03:00:00 UTC+03:00 45int(0) 46string(7) "islamic" 47string(12) "Europe/Minsk" 48 49dimanche 1 janvier 2012 ap. J.-C. 00:00:00 UTC 50bool(false) 51string(9) "gregorian" 52string(3) "UTC" 53 54