I have to do a percentage system where I have 2 dates in TIMEUNIX
, the end date ($cota->ultimo_recebimento)
and the current day that I get with the time()
function of PHP. I tried to do this:
<?php
echo ((time() / $cota->ultimo_recebimento) * 100).' %';
?>
and so on
<?php
echo (100 - (time() / $cota->ultimo_recebimento * 100));
?>
But none gave me a right percentage.
I just need to pass the days on $cota->ultimo_recebimento
by increasing the percentage. After the current date is greater than or equal to $cota->ultimo_recebimento
then it retains 100%
I have 3 variables
$atual = time();
$primeiro = $cota->primeiro_recebimento;
$ultimo = $cota->ultimo_recebimento;