So far I\'ve got this script that counts down the days and hours, but how can I make it also do minutes and seconds?
$remaining = strtotime($ActiveListing[\'Lis
I thought of a solution with date():
$remaining = strtotime($ActiveListing['ListingExpires']) - time();
list($months, $days, $hours, $minutes, $seconds) = explode(" ",date("n j H i s",$remaining));
$months--;$days--;
echo "$months months - $days days - $hours hours - $minutes minutes - $seconds seconds left";
$remaining = strtotime($ActiveListing['ListingExpires']) - time();
$days_remaining = floor($remaining/60/60/24);
$hours_remaining = floor(($remaining-($days_remaining*60*60*24))/60/60);
$minutes_remaining = floor(($remaining-($days_remaining*60*60*24)-($hours_remaining*60*60))/60);
$seconds_remaining = floor(($remaining-($days_remaining*60*60*24)-($hours_remaining*60*60))-($minutes_remaining*60));
$edate = '2027-07-06 07:01:53';
$datestr = $edate;//Your date
$date=strtotime($datestr);//Converted to a PHP date (a second count)
//Calculate difference
$diff=$date-time();//time returns current time in seconds
$days=floor($diff/(60*60*24));//seconds/minute*minutes/hour*hours/day)
$hours=round(($diff-$days*60*60*24)/(60*60));