xref: /PHP-8.0/ext/date/tests/strtotime3.phpt (revision 95f4ee38)
1--TEST--
2strtotime() function (32 bit)
3--SKIPIF--
4<?php if (PHP_INT_SIZE == 8) die("skip 32-bit only"); ?>
5--FILE--
6<?php
7date_default_timezone_set('Europe/Lisbon');
8$time = 1150494719; // 16/June/2006
9
10$strs = array(
11    '',
12    " \t\r\n000",
13    'yesterday',
14    '22:49:12',
15    '22:49:12 bogusTZ',
16    '22.49.12.42GMT',
17    '22.49.12.42bogusTZ',
18    't0222',
19    't0222 t0222',
20    '022233',
21    '022233 bogusTZ',
22    '2-3-2004',
23    '2.3.2004',
24    '20060212T23:12:23UTC',
25    '20060212T23:12:23 bogusTZ',
26    '2006167', //pgydotd
27    'Jan-15-2006', //pgtextshort
28    '2006-Jan-15', //pgtextreverse
29    '10/Oct/2000:13:55:36 +0100', //clf
30    '10/Oct/2000:13:55:36 +00100', //clf
31    '2006',
32    '1986', // year
33    'JAN',
34    'January',
35);
36
37foreach ($strs as $str) {
38    $t = strtotime($str, $time);
39    if (is_integer($t)) {
40        var_dump(date(DATE_RFC2822, $t));
41    } else {
42        var_dump($t);
43    }
44}
45
46?>
47--EXPECTF--
48bool(false)
49bool(false)
50string(31) "Thu, 15 Jun 2006 00:00:00 +0100"
51string(31) "Fri, 16 Jun 2006 22:49:12 +0100"
52bool(false)
53string(31) "Fri, 16 Jun 2006 23:49:12 +0100"
54bool(false)
55string(31) "Fri, 16 Jun 2006 02:22:00 +0100"
56
57Warning: strtotime(): Epoch doesn't fit in a PHP integer in %s on line %d
58bool(false)
59string(31) "Fri, 16 Jun 2006 02:22:33 +0100"
60bool(false)
61string(31) "Tue, 02 Mar 2004 00:00:00 +0000"
62string(31) "Tue, 02 Mar 2004 00:00:00 +0000"
63string(31) "Sun, 12 Feb 2006 23:12:23 +0000"
64bool(false)
65string(31) "Fri, 16 Jun 2006 00:00:00 +0100"
66string(31) "Sun, 15 Jan 2006 00:00:00 +0000"
67string(31) "Sun, 15 Jan 2006 00:00:00 +0000"
68string(31) "Tue, 10 Oct 2000 13:55:36 +0100"
69bool(false)
70string(31) "Fri, 16 Jun 2006 20:06:00 +0100"
71string(31) "Mon, 16 Jun 1986 22:51:59 +0100"
72string(31) "Mon, 16 Jan 2006 00:00:00 +0000"
73string(31) "Mon, 16 Jan 2006 00:00:00 +0000"
74