xref: /PHP-7.4/ext/date/tests/mktime-1.phpt (revision d7a3edd4)
1--TEST--
2Check for mktime with out-of-range parameters
3--INI--
4error_reporting=E_ALL
5--FILE--
6<?php
7
8date_default_timezone_set("Europe/Amsterdam");
9# MacOS/X libc implementation doesn't treat out-of-range values
10# the same way other unices do (Bug# 10686) so some extra code
11# was added to datetime.c to take care of this
12echo date("Y-m-d", mktime( 12, 0, 0, 3,  0, 2000)) ."\n";
13echo date("Y-m-d", mktime( 12, 0, 0, 3, -1, 2000)) ."\n";
14echo date("Y-m-d", mktime( 12, 0, 0, 2, 29, 2000)) ."\n";
15echo date("Y-m-d", mktime( 12, 0, 0, 3,  0, 2001)) ."\n";
16echo date("Y-m-d", mktime( 12, 0, 0, 2, 29, 2001)) ."\n";
17echo date("Y-m-d", mktime( 12, 0, 0, 0,  0, 2000)) ."\n";
18
19?>
20--EXPECT--
212000-02-29
222000-02-28
232000-02-29
242001-02-28
252001-03-01
261999-11-30
27