1--TEST-- 2IntlDateFormatter: get/setTimeZone() 3--SKIPIF-- 4<?php 5if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> 6<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.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( 19$df->getTimeZoneID(), 20$df->getTimeZone()->getID()); 21echo "\n"; 22} 23 24$df = new IntlDateFormatter('pt_PT', 0, 0, 'Europe/Minsk'); 25d($df); 26 27$df->setTimeZone(NULL); 28d($df); 29 30$df->setTimeZone('Europe/Madrid'); 31d($df); 32 33$df->setTimeZone(IntlTimeZone::createTimeZone('Europe/Paris')); 34d($df); 35 36$df->setTimeZone(new DateTimeZone('Europe/Amsterdam')); 37d($df); 38 39?> 40--EXPECTF-- 41Domingo, 1 de Janeiro de 2012 3:00:00 GMT+03:00 42string(12) "Europe/Minsk" 43string(12) "Europe/Minsk" 44 45Sábado, 31 de Dezembro de 2011 23:00:00 Hor%s %Sdos Açores 46string(15) "Atlantic/Azores" 47string(15) "Atlantic/Azores" 48 49Domingo, 1 de Janeiro de 2012 1:00:00 Hor%s %Sda Europa Central 50string(13) "Europe/Madrid" 51string(13) "Europe/Madrid" 52 53Domingo, 1 de Janeiro de 2012 1:00:00 Hor%s %Sda Europa Central 54string(12) "Europe/Paris" 55string(12) "Europe/Paris" 56 57Domingo, 1 de Janeiro de 2012 1:00:00 Hor%s %Sda Europa Central 58string(16) "Europe/Amsterdam" 59string(16) "Europe/Amsterdam" 60 61