Hi All, How do I conver the following to a percentage of difference. When the days, hours, minutes, seconds equal zero, this will be 100% $expirationDate = strtotime("2015-12-20 23:10:00"); $toDay = strtotime(date('Y-m-d H:i:s')); $difference = abs($toDa - $expirationDate); $days = floor($difference / 86400); $hours = floor(($difference - $days * 86400) / 3600); $minutes = floor(($difference - $days * 86400 - $hours * 3600) / 60); $seconds = floor($difference - $days * 86400 - $hours * 3600 - $minutes * 60); PHP: Cheers, FishSword
%Usage = [ time() - $startingDate ] / [ $expiryDate - $startingDate ] * 100 That would infer 100% for fully used service however. So in your case I guess you have to use 1 to kind of "reverse" it