1--TEST-- 2IntlDateFormatter: several forms of the calendar arg 3--EXTENSIONS-- 4intl 5--SKIPIF-- 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 16$cal = new IntlGregorianCalendar('UTC', NULL); 17$df = new IntlDateFormatter('es_ES', 0, 0, NULL, $cal); 18echo $df->format($ts), "\n"; 19 20$cal = IntlCalendar::createInstance('UTC', 'en@calendar=islamic'); 21$df = new IntlDateFormatter('es_ES', 0, 0, NULL, $cal); 22echo $df->format($ts), "\n"; 23 24//override calendar's timezone 25$cal = new IntlGregorianCalendar('UTC', NULL); 26$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Madrid', $cal); 27echo $df->format($ts), "\n"; 28 29//default calendar is gregorian 30$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0); 31echo $df->format($ts), "\n"; 32 33//try now with traditional 34$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0, NULL, IntlDateFormatter::TRADITIONAL); 35echo $df->format($ts), "\n"; 36 37//the timezone can be overridden when not specifying a calendar 38$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0, 'UTC', IntlDateFormatter::TRADITIONAL); 39echo $df->format($ts), "\n"; 40 41$df = new IntlDateFormatter('es_ES', 0, 0, 'UTC', 0); 42echo $df->format($ts), "\n"; 43 44?> 45--EXPECTF-- 46domingo%S 1 de enero de 2012, 0:00:00 (GMT) 47domingo%S 8 de Safar de 1433, 0:00:00 (GMT) 48domingo, 1 de enero de 2012, 1:00:00 (hora estándar de Europa central) 49sábado, 31 de diciembre de 2011 d. C., 23:00:00 (hora estándar de las Azores) 50sábado, 7 de Safar de 1433 AH, 23:00:00 (hora estándar de las Azores) 51domingo%S 8 de Safar de 1433 AH, 0:00:00 (GMT) 52domingo%S 1 de enero de 2012, 0:00:00 (GMT) 53