1--TEST--
2IntlTimeZone::fromDateTimeZone(): basic test
3--EXTENSIONS--
4intl
5--FILE--
6<?php
7ini_set("intl.error_level", E_WARNING);
8ini_set("intl.default_locale", "nl");
9date_default_timezone_set('Europe/Lisbon');
10
11$tz = IntlTimeZone::fromDateTimeZone(new DateTimeZone('Europe/Amsterdam'));
12var_dump($tz->getID(), $tz->getRawOffset());
13
14
15$dt = new DateTime('2012-01-01 00:00:00 CET');
16$dtz = $dt->getTimeZone();
17/* this is different from new DateTimeZone('CET'),
18 * which gives a Europe/Berlin timezone */
19var_dump($dtz->getName());
20$tz = IntlTimeZone::fromDateTimeZone($dtz);
21var_dump($tz->getID(), $tz->getRawOffset());
22
23
24$dt = new DateTime('2012-01-01 00:00:00 +0340');
25$dtz = $dt->getTimeZone();
26/* I don't think this timezone can be generated without a DateTime object */
27var_dump($dtz->getName());
28$tz = IntlTimeZone::fromDateTimeZone($dtz);
29var_dump($tz->getID(), $tz->getRawOffset() /* (3*60+40)*60000 */);
30?>
31--EXPECTF--
32string(16) "Europe/Amsterdam"
33int(3600000)
34string(3) "CET"
35string(3) "CET"
36int(3600000)
37string(6) "+03:40"
38string(%d) "GMT+03%s0"
39int(13200000)
40