i have managed to be able to work out the time left for my ‘auction’ style site, however i am struggling to make the time_left variable turn red when it is less than 60 minutes to go.
Here is the code below that does it, at the moment the time left is just the #333 colour and doesn’t turn into the #9f1717
$date = date('m/d/Y h:i:s', time());
$date3 = new DateTime($date);
$date4 = new DateTime($date_finished);
$interval_date = $date3->diff($date4);
//$time_left = $interval_date->d."d ". $interval_date->h."h ". $interval_date->i."m ";
$time_left = (($interval_date->d) ? $interval_date->d.'d ' : ''). (($interval_date->h) ? $interval_date->h.'h ' : ''). $interval_date->i.'m ';
$date_fini = date("d/m H:m", strtotime($date_finished));
if('m' < '59' && ('d'=='' && 'H' =='')){
$pro_order_colour = "#9f1717";
}
else{
$pro_order_colour = "#333";
}
Thankyou for all and any help
Ok, after a bit of searching on google i tried the strpos() function to see whether there was a d or h in the time_left string, if there was not, it meant there was less than an hour left, so i could then change it to red. Here is the working code.