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