1--TEST-- 2IntlCalendar::fromDateTime(): basic test 3--SKIPIF-- 4<?php 5if (!extension_loaded('intl')) 6 die('skip intl extension not enabled'); 7--FILE-- 8<?php 9ini_set("intl.error_level", E_WARNING); 10ini_set("intl.default_locale", "nl_NL"); 11date_default_timezone_set('Europe/Lisbon'); 12 13$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00 Europe/Rome'); 14var_dump( 15 $cal->getTime(), 16 strtotime('2012-01-01 00:00:00 Europe/Rome') * 1000., 17 $cal->getTimeZone()->getID(), 18 $cal->getLocale(1) 19); 20echo "\n"; 21 22$cal = IntlCalendar::fromDateTime(new DateTime('2012-01-01 00:00:00 PST'), "pt_PT"); 23var_dump( 24 $cal->getTime(), 25 strtotime('2012-01-01 00:00:00 PST') * 1000., 26 $cal->getTimeZone()->getID(), 27 $cal->getLocale(1) 28); 29 30echo "\n"; 31 32$cal = intlcal_from_date_time(new DateTime('2012-01-01 00:00:00 +03:40')); 33var_dump( 34 $cal->getTime(), 35 strtotime('2012-01-01 00:00:00 +03:40') * 1000., 36 $cal->getTimeZone()->getID() 37); 38?> 39--EXPECTF-- 40float(1325372400000) 41float(1325372400000) 42string(11) "Europe/Rome" 43string(5) "nl_NL" 44 45float(1325404800000) 46float(1325404800000) 47string(3) "PST" 48string(5) "pt_PT" 49 50float(1325362800000) 51float(1325362800000) 52string(%d) "GMT+03%S40" 53