I created a php script that gives me the difference between two dates, the result is showed in a column inside a bootstrap badge, im trying to change the color of the badge according to the value of the result obtained, for example green if it is less than 10 days, yellow if it is between 10 and 20 days and red if it is more than 20 days, finally if the result obtained is greater than 35 days maybe got a blinking effect on the badge ...
I make this to get (and display) the values:
php
$date1 = date_create($lines3x['date1']);
$date2 = date_create($lines3x['date2']);
$date3 = date_create($lines3x['date3']);
//difference between two dates
$diff = date_diff($date1,$date2);
$diff2 = date_diff($date3,$date1);
span class="badge badge-info"
echo $diff2->format("%a");
/span
span class="badge badge-info"
if($diff > "10"){ echo $diff->format("%a");
/span
And i tried this whit no success:
if ($diff < "10"){ echo "span class="badge badge-success"
Aucun commentaire:
Enregistrer un commentaire