xref: /php-src/ext/date/tests/mktime-3.phpt (revision 95f4ee38)
1--TEST--
2mktime() [3] (32-bit)
3--SKIPIF--
4<?php if (PHP_INT_SIZE == 8) die("skip 32-bit only"); ?>
5--INI--
6error_reporting=2047
7--FILE--
8<?php
9$tzs = array("America/Toronto", "Europe/Oslo");
10$years = array(0, 69, 70, 71, 99, 100, 105, 1900, 1901, 1902, 1999, 2000, 2001);
11
12foreach ($tzs as $tz) {
13    echo $tz, "\n";
14    date_default_timezone_set($tz);
15    foreach ($years as $year) {
16        printf("Y: %4d - ", $year);
17        $ret = @mktime(1, 1, 1, 1, 1, $year);
18        if ($ret == FALSE) {
19            echo "out of range\n";
20        } else {
21            echo date("F ".DATE_ISO8601, $ret), "\n";
22        }
23    }
24    echo "\n";
25}
26?>
27--EXPECT--
28America/Toronto
29Y:    0 - January 2000-01-01T01:01:01-0500
30Y:   69 - out of range
31Y:   70 - January 1970-01-01T01:01:01-0500
32Y:   71 - January 1971-01-01T01:01:01-0500
33Y:   99 - January 1999-01-01T01:01:01-0500
34Y:  100 - January 2000-01-01T01:01:01-0500
35Y:  105 - out of range
36Y: 1900 - out of range
37Y: 1901 - out of range
38Y: 1902 - January 1902-01-01T01:01:01-0500
39Y: 1999 - January 1999-01-01T01:01:01-0500
40Y: 2000 - January 2000-01-01T01:01:01-0500
41Y: 2001 - January 2001-01-01T01:01:01-0500
42
43Europe/Oslo
44Y:    0 - January 2000-01-01T01:01:01+0100
45Y:   69 - out of range
46Y:   70 - January 1970-01-01T01:01:01+0100
47Y:   71 - January 1971-01-01T01:01:01+0100
48Y:   99 - January 1999-01-01T01:01:01+0100
49Y:  100 - January 2000-01-01T01:01:01+0100
50Y:  105 - out of range
51Y: 1900 - out of range
52Y: 1901 - out of range
53Y: 1902 - January 1902-01-01T01:01:01+0100
54Y: 1999 - January 1999-01-01T01:01:01+0100
55Y: 2000 - January 2000-01-01T01:01:01+0100
56Y: 2001 - January 2001-01-01T01:01:01+0100
57
58