1--TEST--
2strtotime() with relative offsets
3--FILE--
4<?php
5
6date_default_timezone_set('UTC');
7
8$base_time = 1204200000; // 28 Feb 2008 12:00:00
9
10$offsets = array(
11	// offset around a day
12	'80412 seconds',
13	'86399 seconds',
14	'86400 seconds',
15	'86401 seconds',
16	'112913 seconds',
17
18	// offset around 7 days
19	'134 hours',
20	'167 hours',
21	'168 hours',
22	'169 hours',
23	'183 hours',
24
25	// offset around 6 months
26	'178 days',
27	'179 days',
28	'180 days',
29	'183 days',
30	'184 days',
31
32	// offset around 10 years
33	'115 months',
34	'119 months',
35	'120 months',
36	'121 months',
37	'128 months',
38
39	// offset around 25 years (can't do much more reliably with strtotime)
40	'24 years',
41	'25 years',
42	'26 years'
43);
44
45foreach ($offsets AS $offset) {
46	foreach (array('+', '-') AS $direction) {
47		echo "$direction$offset: " . date(DATE_ISO8601, strtotime("$direction$offset", $base_time)) . "\n";
48	}
49}
50
51?>
52--EXPECT--
53+80412 seconds: 2008-02-29T10:20:12+0000
54-80412 seconds: 2008-02-27T13:39:48+0000
55+86399 seconds: 2008-02-29T11:59:59+0000
56-86399 seconds: 2008-02-27T12:00:01+0000
57+86400 seconds: 2008-02-29T12:00:00+0000
58-86400 seconds: 2008-02-27T12:00:00+0000
59+86401 seconds: 2008-02-29T12:00:01+0000
60-86401 seconds: 2008-02-27T11:59:59+0000
61+112913 seconds: 2008-02-29T19:21:53+0000
62-112913 seconds: 2008-02-27T04:38:07+0000
63+134 hours: 2008-03-05T02:00:00+0000
64-134 hours: 2008-02-22T22:00:00+0000
65+167 hours: 2008-03-06T11:00:00+0000
66-167 hours: 2008-02-21T13:00:00+0000
67+168 hours: 2008-03-06T12:00:00+0000
68-168 hours: 2008-02-21T12:00:00+0000
69+169 hours: 2008-03-06T13:00:00+0000
70-169 hours: 2008-02-21T11:00:00+0000
71+183 hours: 2008-03-07T03:00:00+0000
72-183 hours: 2008-02-20T21:00:00+0000
73+178 days: 2008-08-24T12:00:00+0000
74-178 days: 2007-09-03T12:00:00+0000
75+179 days: 2008-08-25T12:00:00+0000
76-179 days: 2007-09-02T12:00:00+0000
77+180 days: 2008-08-26T12:00:00+0000
78-180 days: 2007-09-01T12:00:00+0000
79+183 days: 2008-08-29T12:00:00+0000
80-183 days: 2007-08-29T12:00:00+0000
81+184 days: 2008-08-30T12:00:00+0000
82-184 days: 2007-08-28T12:00:00+0000
83+115 months: 2017-09-28T12:00:00+0000
84-115 months: 1998-07-28T12:00:00+0000
85+119 months: 2018-01-28T12:00:00+0000
86-119 months: 1998-03-28T12:00:00+0000
87+120 months: 2018-02-28T12:00:00+0000
88-120 months: 1998-02-28T12:00:00+0000
89+121 months: 2018-03-28T12:00:00+0000
90-121 months: 1998-01-28T12:00:00+0000
91+128 months: 2018-10-28T12:00:00+0000
92-128 months: 1997-06-28T12:00:00+0000
93+24 years: 2032-02-28T12:00:00+0000
94-24 years: 1984-02-28T12:00:00+0000
95+25 years: 2033-02-28T12:00:00+0000
96-25 years: 1983-02-28T12:00:00+0000
97+26 years: 2034-02-28T12:00:00+0000
98-26 years: 1982-02-28T12:00:00+0000
99