summaryrefslogtreecommitdiff
path: root/ext/intl/tests/dateformat_timezone_arg_variations4.phpt
blob: 7be709a66f88cb3de3fbf55de6048cf5cee2c3d1 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--TEST--
IntlDateFormatter: several forms of the timezone arg
--SKIPIF--
<?php
if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '54.1') < 0) die('skip for ICU >= 54.1'); ?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("date.timezone", 'Atlantic/Azores');

$ts = strtotime('2012-01-01 00:00:00 UTC');

//should use Atlantic/Azores
$df = new IntlDateFormatter('es_ES', 0, 0, NULL);
echo $df->format($ts), "\n";

$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam');
echo $df->format($ts), "\n";

$df = new IntlDateFormatter('es_ES', 0, 0, new DateTimeZone('Europe/Lisbon'));
echo $df->format($ts), "\n";

$df = new IntlDateFormatter('es_ES', 0, 0, IntlTimeZone::createTimeZone('America/New_York'));
echo $df->format($ts), "\n";

//time zone has priority
$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam', new IntlGregorianCalendar('Europe/Lisbon'));
echo $df->format($ts), "\n";

//calendar has priority
$df = new IntlDateFormatter('es_ES', 0, 0, NULL, new IntlGregorianCalendar('Europe/Lisbon'));
echo $df->format($ts), "\n";

$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam', 0);
echo $df->format($ts), "\n";

--EXPECTF--
sábado, 31 de diciembre de 2011, 23:00:00 (hora estándar de las Azores)
domingo, 1 de enero de 2012, 1:00:00 (hora estándar de Europa central)
domingo, 1 de enero de 2012, 0:00:00 (hora estándar de Europa occidental)
sábado, 31 de diciembre de 2011, 19:00:00 (hora estándar oriental)
domingo, 1 de enero de 2012, 1:00:00 (hora estándar de Europa central)
domingo, 1 de enero de 2012, 0:00:00 (hora estándar de Europa occidental)
domingo, 1 de enero de 2012, 1:00:00 (hora estándar de Europa central)