xref: /PHP-8.1/ext/date/tests/getdate_basic.phpt (revision b5c7a83d)
1--TEST--
2Test getdate() function : basic functionality
3--FILE--
4<?php
5echo "*** Testing getdate() : basic functionality ***\n";
6
7//Set the default time zone
8date_default_timezone_set("Asia/Calcutta");
9
10// Initialise all required variables
11$timestamp = 10;
12
13// Calling getdate() with all possible arguments
14var_dump( getdate($timestamp) );
15
16// Calling getdate() with mandatory arguments
17var_dump( getdate() );
18
19?>
20--EXPECTF--
21*** Testing getdate() : basic functionality ***
22array(11) {
23  ["seconds"]=>
24  int(10)
25  ["minutes"]=>
26  int(30)
27  ["hours"]=>
28  int(5)
29  ["mday"]=>
30  int(1)
31  ["wday"]=>
32  int(4)
33  ["mon"]=>
34  int(1)
35  ["year"]=>
36  int(1970)
37  ["yday"]=>
38  int(0)
39  ["weekday"]=>
40  string(8) "Thursday"
41  ["month"]=>
42  string(7) "January"
43  [0]=>
44  int(10)
45}
46array(11) {
47  ["seconds"]=>
48  int(%d)
49  ["minutes"]=>
50  int(%d)
51  ["hours"]=>
52  int(%d)
53  ["mday"]=>
54  int(%d)
55  ["wday"]=>
56  int(%d)
57  ["mon"]=>
58  int(%d)
59  ["year"]=>
60  int(%d)
61  ["yday"]=>
62  int(%d)
63  ["weekday"]=>
64  string(%d) %s
65  ["month"]=>
66  string(%d) %s
67  [0]=>
68  int(%d)
69}
70