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