Annotation of embedaddon/php/ext/date/tests/gmdate_variation7.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test gmdate() function : usage variation - Passing Year format options to format argument.
3: --FILE--
4: <?php
5: /* Prototype : string gmdate(string format [, long timestamp])
6: * Description: Format a GMT date/time
7: * Source code: ext/date/php_date.c
8: * Alias to functions:
9: */
10:
11: echo "*** Testing gmdate() : usage variation ***\n";
12:
13: // Initialise all required variables
14: date_default_timezone_set('UTC');
15: $timestamp = mktime(8, 8, 8, 8, 8, 2008);
16: $timestamp_non_leap_year = mktime(8, 8, 8, 8, 8, 2007);
17:
18: echo "\n-- Testing gmdate() function with checking non leap year using Leap Year format --\n";
19: var_dump( gmdate('L', $timestamp_non_leap_year) );
20:
21: echo "\n-- Testing gmdate() function with checking leap year using Leap Year format --\n";
22: var_dump( gmdate('L') );
23: var_dump( gmdate('L', $timestamp) );
24:
25: echo "\n-- Testing gmdate() function with ISO-8601 year number format --\n";
26: var_dump( gmdate('o') );
27: var_dump( gmdate('o', $timestamp) );
28:
29: echo "\n-- Testing gmdate() function with full numeric representation of year format --\n";
30: var_dump( gmdate('Y') );
31: var_dump( gmdate('Y', $timestamp) );
32:
33: echo "\n-- Testing gmdate() function with 2 digit representation year format --\n";
34: var_dump( gmdate('y') );
35: var_dump( gmdate('y', $timestamp) );
36:
37: ?>
38: ===DONE===
39: --EXPECTF--
40: *** Testing gmdate() : usage variation ***
41:
42: -- Testing gmdate() function with checking non leap year using Leap Year format --
43: string(1) "0"
44:
45: -- Testing gmdate() function with checking leap year using Leap Year format --
46: string(1) "%d"
47: string(1) "1"
48:
49: -- Testing gmdate() function with ISO-8601 year number format --
50: string(4) "%d"
51: string(4) "2008"
52:
53: -- Testing gmdate() function with full numeric representation of year format --
54: string(4) "%d"
55: string(4) "2008"
56:
57: -- Testing gmdate() function with 2 digit representation year format --
58: string(2) "%d"
59: string(2) "08"
60: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>