Skip to content

Instantly share code, notes, and snippets.

@m8rge m8rge/date_diff.php
Created Jun 27, 2017

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
You can’t perform that action at this time.