xref: /PHP-8.0/ext/date/tests/012.phpt (revision 5dafd7b4)
1--TEST--
2date_isodate_set() tests
3--FILE--
4<?php
5date_default_timezone_set('UTC');
6
7$dto = date_create("2006-12-12");
8var_dump(date_isodate_set($dto, 2006, 2, 15));
9var_dump($dto->format("Y/m/d H:i:s"));
10var_dump(date_isodate_set($dto, 2006, 5));
11var_dump($dto->format("Y/m/d H:i:s"));
12var_dump(date_isodate_set($dto, 2006, 100, 15));
13var_dump($dto->format("Y/m/d H:i:s"));
14echo "Done\n";
15?>
16--EXPECT--
17object(DateTime)#1 (3) {
18  ["date"]=>
19  string(26) "2006-01-23 00:00:00.000000"
20  ["timezone_type"]=>
21  int(3)
22  ["timezone"]=>
23  string(3) "UTC"
24}
25string(19) "2006/01/23 00:00:00"
26object(DateTime)#1 (3) {
27  ["date"]=>
28  string(26) "2006-01-30 00:00:00.000000"
29  ["timezone_type"]=>
30  int(3)
31  ["timezone"]=>
32  string(3) "UTC"
33}
34string(19) "2006/01/30 00:00:00"
35object(DateTime)#1 (3) {
36  ["date"]=>
37  string(26) "2007-12-10 00:00:00.000000"
38  ["timezone_type"]=>
39  int(3)
40  ["timezone"]=>
41  string(3) "UTC"
42}
43string(19) "2007/12/10 00:00:00"
44Done
45