run code in 150+ php & hhvm versions
Bugs & Features
<?php $now = new DateTime('now'); $date = DateTime::createFromFormat('YmdHis', '2004' . $now->format('md') . '000000'); $diff = $date->diff($now, true); printf( 'Got %s and expected %s', $now->sub($diff)->format(DateTime::ISO8601), $date->format(DateTime::ISO8601) );
Output for 5.6.28, 7.0.14 - 7.1.0
Got 2004-11-26T00:00:00+0100 and expected 2004-11-26T00:00:00+0100
Output for 7.0.6
Got 2004-05-03T00:00:00+0200 and expected 2004-05-03T00:00:00+0200
Output for 7.0.5
Got 2004-04-03T00:00:00+0200 and expected 2004-04-03T00:00:00+0200
Output for 7.0.4
Got 2004-03-10T00:00:00+0100 and expected 2004-03-10T00:00:00+0100
Output for 7.0.3
Got 2004-03-18T00:00:00+0100 and expected 2004-03-18T00:00:00+0100
Output for 7.0.2
Got 2004-03-22T00:00:00+0100 and expected 2004-03-22T00:00:00+0100
Output for 7.0.1
Got 2004-03-24T00:00:00+0100 and expected 2004-03-24T00:00:00+0100
Output for 7.0.0
Got 2004-03-27T00:00:00+0100 and expected 2004-03-27T00:00:00+0100
Output for 5.6.21
Got 2004-05-02T00:00:00+0200 and expected 2004-05-02T00:00:00+0200
Output for 5.6.20
Got 2004-04-10T00:00:00+0200 and expected 2004-04-10T00:00:00+0200
Output for 5.6.19
Got 2004-03-07T00:00:00+0100 and expected 2004-03-07T00:00:00+0100
Output for 5.6.18
Got 2004-03-15T00:00:00+0100 and expected 2004-03-15T00:00:00+0100
Output for 5.6.17
Got 2004-03-19T00:00:00+0100 and expected 2004-03-19T00:00:00+0100
Output for 5.6.16
Got 2004-03-28T00:00:00+0100 and expected 2004-03-28T00:00:00+0100
Output for 5.6.15
Got 2004-03-29T00:00:00+0200 and expected 2004-03-29T00:00:00+0200
Output for 5.6.14
Got 2004-04-02T00:00:00+0200 and expected 2004-04-02T00:00:00+0200
Output for 5.6.13
Got 2004-04-15T00:00:00+0200 and expected 2004-04-15T00:00:00+0200
Output for 5.6.12
Got 2004-04-20T00:00:00+0200 and expected 2004-04-20T00:00:00+0200
Output for 5.6.11
Got 2004-04-23T00:00:00+0200 and expected 2004-04-23T00:00:00+0200
Output for 5.6.10
Got 2004-04-25T00:00:00+0200 and expected 2004-04-25T00:00:00+0200
Output for 5.6.9
Got 2004-04-27T00:00:00+0200 and expected 2004-04-27T00:00:00+0200
Output for 5.6.8
Got 2004-04-30T00:00:00+0200 and expected 2004-04-30T00:00:00+0200
Output for 5.5.35
Got 2004-05-22T00:00:00+0200 and expected 2004-05-22T00:00:00+0200
Output for 5.5.34
Got 2004-04-11T00:00:00+0200 and expected 2004-04-11T00:00:00+0200
Output for 5.5.33
Got 2004-03-09T00:00:00+0100 and expected 2004-03-09T00:00:00+0100
Output for 5.5.32
Got 2004-03-17T00:00:00+0100 and expected 2004-03-17T00:00:00+0100
Output for 5.5.31
Got 2004-03-20T00:00:00+0100 and expected 2004-03-20T00:00:00+0100
Output for 5.5.30
Got 2004-04-01T00:00:00+0200 and expected 2004-04-01T00:00:00+0200
Output for 5.5.29
Got 2004-04-17T00:00:00+0200 and expected 2004-04-17T00:00:00+0200
Output for 5.5.28
Got 2004-04-21T00:00:00+0200 and expected 2004-04-21T00:00:00+0200
Output for 5.5.27
Got 2004-04-22T00:00:00+0200 and expected 2004-04-22T00:00:00+0200
Output for 5.5.26
Got 2004-04-26T00:00:00+0200 and expected 2004-04-26T00:00:00+0200
Output for 5.5.25
Got 2004-04-28T00:00:00+0200 and expected 2004-04-28T00:00:00+0200
Output for 5.5.24
Got 2004-05-24T00:00:00+0200 and expected 2004-05-24T00:00:00+0200
Output for 5.3.0 - 5.4.45
Got 2004-11-18T00:00:00+0100 and expected 2004-11-18T00:00:00+0100
Output for 5.2.10 - 5.2.17
Fatal error: Call to undefined method DateTime::createFromFormat() in /in/RNuod on line 4
Process exited with code 255.
Output for 5.2.0 - 5.2.9
Fatal error: Call to undefined method DateTime::createfromformat() in /in/RNuod on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/RNuod on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/RNuod on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/RNuod on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/RNuod on line 10
Process exited with code 255.