Home /php /Show the Days # difference from a time stamp PHP Function /

Show the Days # difference from a time stamp PHP Function

2:17 am, April 23, 2017

Original Post Date: 12:03 am, August 26, 2014

Shows the difference between now and a timestamp, you could also replace this with another timestamp to get the difference between another timestamp.

function time_diff_days($your_date) {
     $now = time(); // or your date as well
     $your_date = strtotime($your_date);
     $datediff = $now - $your_date;
     return floor($datediff/(60*60*24));	
}

just made a function from the stack overflow version of this.

function time_diff_days($your_date) { $now = time(); // or your date as well $your_date = strtotime($your_date); $datediff = $now - $your_date; return floor($datediff/(60*60*24)); }