blob: 1c5169e65ddddec3851e5b2614b5cd2064467ae2 (
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
47
48
49
50
51
52
53
54
55
|
--TEST--
IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject()
--SKIPIF--
<?php
if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
ini_set("date.timezone", 'Atlantic/Azores');
$ts = strtotime('2012-01-01 00:00:00 UTC');
function d(IntlDateFormatter $df) {
global $ts;
echo $df->format($ts), "\n";
var_dump($df->getCalendar(),
$df->getCalendarObject()->getType(),
$df->getCalendarObject()->getTimeZone()->getId());
echo "\n";
}
$df = new IntlDateFormatter('fr@calendar=islamic', 0, 0, 'Europe/Minsk');
d($df);
//changing the calendar with a cal type should not change tz
$df->setCalendar(IntlDateFormatter::TRADITIONAL);
d($df);
//but changing with an actual calendar should
$cal = IntlCalendar::createInstance("UTC");
$df->setCalendar($cal);
d($df);
?>
==DONE==
--EXPECT--
dimanche 1 janvier 2012 ap. J.-C. 03:00:00 UTC+03:00
int(1)
string(9) "gregorian"
string(12) "Europe/Minsk"
dimanche 8 safar 1433 AH 03:00:00 UTC+03:00
int(0)
string(7) "islamic"
string(12) "Europe/Minsk"
dimanche 1 janvier 2012 ap. J.-C. 00:00:00 UTC
bool(false)
string(9) "gregorian"
string(3) "UTC"
==DONE==
|