0
I have to do a percentage system where I have 2 dates in TIMEUNIX
, being the final date ($cota->ultimo_recebimento)
and the current day I catch up with the function time()
from PHP. I tried to do so:
<?php
echo ((time() / $cota->ultimo_recebimento) * 100).' %';
?>
and also so
<?php
echo (100 - (time() / $cota->ultimo_recebimento * 100));
?>
But none gave me a certain percentage.
I just need him to spend his days based on $cota->ultimo_recebimento
increases the percentage. After the current date is greater than or equal to $cota->ultimo_recebimento
so he keeps in 100%
I have 3 variables
$atual = time();
$primeiro = $cota->primeiro_recebimento;
$ultimo = $cota->ultimo_recebimento;
If I understand correctly, you don’t have enough data to know that percentage. To know the percentage of running time you need 3 dates: start, current and end; or 2 intervals: total time (end - start), time to end (end - current), only with these 2 values (current and end).
– Berriel
Have
$cota->primeiro_recebimento
yes, I forgot to put– Alisson Acioli
@Berriel with this data, you can help ?
– Alisson Acioli
See if the answer helps you...
– Berriel