xref: /PHP-8.4/ext/date/tests/date_diff1.phpt (revision c8a6a8ab)
1--TEST--
2Test for date_diff with timezone abbreviations.
3--INI--
4date.timezone=Europe/London
5--FILE--
6<?php
7$start = new DateTime('2010-10-04 02:18:48 EDT');
8$end   = new DateTime('2010-11-06 18:38:28 EDT');
9$int = $start->diff($end);
10var_dump($start);
11var_dump($end);
12var_dump($int);
13?>
14--EXPECTF--
15object(DateTime)#1 (3) {
16  ["date"]=>
17  string(26) "2010-10-04 02:18:48.000000"
18  ["timezone_type"]=>
19  int(2)
20  ["timezone"]=>
21  string(3) "EDT"
22}
23object(DateTime)#2 (3) {
24  ["date"]=>
25  string(26) "2010-11-06 18:38:28.000000"
26  ["timezone_type"]=>
27  int(2)
28  ["timezone"]=>
29  string(3) "EDT"
30}
31object(DateInterval)#%d (%d) {
32  ["y"]=>
33  int(0)
34  ["m"]=>
35  int(1)
36  ["d"]=>
37  int(2)
38  ["h"]=>
39  int(%d)
40  ["i"]=>
41  int(19)
42  ["s"]=>
43  int(40)
44  ["f"]=>
45  float(0)
46  ["invert"]=>
47  int(0)
48  ["days"]=>
49  int(33)
50  ["from_string"]=>
51  bool(false)
52}
53