summaryrefslogtreecommitdiff
path: root/ext/intl/tests/calendar_setTimeZone_variation2.phpt
blob: 3789f032e21397c10f1909ce7306f3b28e6d95cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--TEST--
IntlCalendar::setTimeZone(): different ways to specify time zone
--SKIPIF--
<?php
if (!extension_loaded('intl'))
	die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
date_default_timezone_set('Europe/Amsterdam');

$intlcal = new IntlGregorianCalendar();
$intlcal->setTimeZone('Europe/Paris');
var_dump($intlcal->getTimeZone()->getID());
$intlcal->setTimeZone(new DateTimeZone('Europe/Madrid'));
var_dump($intlcal->getTimeZone()->getID());

$pstdate = new DateTime('2012-01-01 00:00:00 PST');
$intlcal->setTimeZone($pstdate->getTimeZone());
var_dump($intlcal->getTimeZone()->getID());

$offsetdate = new DateTime('2012-01-01 00:00:00 -02:30');
$intlcal->setTimeZone($offsetdate->getTimeZone());
var_dump($intlcal->getTimeZone()->getID());
?>
--EXPECTF--
string(12) "Europe/Paris"
string(13) "Europe/Madrid"
string(3) "PST"
string(%d) "GMT-02%S30"