Skip to content

Instantly share code, notes, and snippets.



Last active Aug 31, 2016
What would you like to do?
public function testInterval()
$date = new DateTime('+1 month');
$date->add(\DateInterval::createFromDateString('3 months'));
// Tested on 2016-08-31
// Failed asserting that two DateTime objects are equal.
// Expected :2016-12-31T14:28:49+0000
// Actual :2017-01-01T14:28:49+0000
static::assertEquals(new DateTime('+4 months'), $date);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment