1
I need to calculate the achieved adhesion between two hours.
- Charge 1: Charge is the end time - the start time
- Charge 2: Scheduled load is the scheduled end time - the scheduled start time.
at the precise end of the percentage 0.95 por exemplo
Load 1 / Load 2 in excel this works in Javascript too but in PHP I’m having problems.
I printed the data:
Realizado: 2016-10-24 15:10:00 - 2016-10-24 07:39:12 = Carga1: 07:30:48
Programado: 15:10:00 - 07:00:00 = Carga2: 08:10:00
Percentual: 0.875
*The accomplished format comes with date and the programmed only time, I tried to leave the two in the same format but it did not work.
I’m going this way:
$date1 = strtotime($ponto_inicio);
$date2 = strtotime($ponto_fim);
$realizado = date( 'H:i:s', abs( $date2 - $date1 ) );
$date3 = strtotime($hora_inicio);
$date4 = strtotime($hora_fim);
$programado = date( 'H:i:s', abs( $date4 - $date3 ) );
$percentual = $realizado / $programado;
100% results are ok but when it comes out of it the result is always 0.88
for different scheduled time.
What is wrong?
You can find examples of $starting point, $ending point, $starting time, and $ending time that are being used in the example?
– NewtonWagner
I put the data used.
– Cleverson