Created
June 27, 2017 04:52
-
-
Save m8rge/e2c927824b86cb8e7088cc06ce94ba95 to your computer and use it in GitHub Desktop.
Как правильно посмотреть, что одна дата больше другой на N дней
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$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