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, '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( 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==DONE== 41--EXPECTF-- 42Domingo, 1 de Janeiro de 2012 às 03:00:00 GMT+03:00 43string(12) "Europe/Minsk" 44string(12) "Europe/Minsk" 45 46Sábado, 31 de Dezembro de 2011 às 23:00:00 Hor%s %Sdos Açores 47string(15) "Atlantic/Azores" 48string(15) "Atlantic/Azores" 49 50Domingo, 1 de Janeiro de 2012 às 01:00:00 Hor%s %Sda Europa Central 51string(13) "Europe/Madrid" 52string(13) "Europe/Madrid" 53 54Domingo, 1 de Janeiro de 2012 às 01:00:00 Hor%s %Sda Europa Central 55string(12) "Europe/Paris" 56string(12) "Europe/Paris" 57 58Domingo, 1 de Janeiro de 2012 às 01:00:00 Hor%s %Sda Europa Central 59string(16) "Europe/Amsterdam" 60string(16) "Europe/Amsterdam" 61 62==DONE== 63