Instantly share code, notes, and snippets.

What would you like to do?
Как правильно посмотреть, что одна дата больше другой на N дней
$date1 = new \DateTime('2017-01-01');
$date2 = new \DateTime('2017-01-10');
$dateInterval = $date1->diff($date2); // this is not date1-date2, but date2-date1 :-(
var_dump($dateInterval->format('%r%a') > 3); // :-(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment