Production in PHP hours

Asked

Viewed 42 times

0

Talks personal, I’m developing a page, and arrived at the time I particularly do not understand much, calculation of hours in php, following: I have values that come from the database, which are:

  • Shift time (08:00:00)(h:m:s) (value varies according to turn)
  • Pairs per hour (15 pairs per hour) (value varies according to machine)
  • Production, which comes from an input

I want to realize this account, pairs per hour * shift time, which gives me the total production of 100%, then only make a rule of 3 to know the efficiency of the shift;

someone suggests something to me?

  • Glue a part of the code you already have there! Ai makes it easy for us to help you!

1 answer

0

I managed with the following gambiarra:

    $horario: '08:20:00';
    $pares_p_hora : !valor vindo do BD;
    $producao = !valor vindo do BD;



    $segundos = strtotime('1970-01-01 '.$horario.'UTC');
    $tempo_producao = ($pares_p_hora / 3600);
    $tempo_producao = number_format(($tempo_producao * $segundos), 0, ',', '.');
    $eficiencia = number_format((($producao * 100) / $tempo_producao), 0, ',', '.');
    echo "eficiencia: ".$eficiencia."%<br>";

Browser other questions tagged

You are not signed in. Login or sign up in order to post.