function - How do I check to see if action occurred up to 5 days before today in PHP? -


this question has answer here:

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

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -