function - How do I check to see if action occurred up to 5 days before today in PHP? -
this question has answer here:
- php check if date between 2 dates 7 answers
i'm working on function see if sms sent within last 5 days of 'today'. can check if it's been sent today (see below) i'm struggling 5 days earlier part.
// check if sms sent today if ($this->sms_sent == $today->format('y-m-d')) { return true; }
i need know if sms sent 5 days ago.
use
$now=date('y-m-d'); $days_ago = date('y-m-d', strtotime('-5 days', strtotime($now )));//get 5 days before date if($this->sms_sent <= $now && $this->sms_sent >= $days_ago) { // it's between }
Comments
Post a Comment