Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function converterHorasMinutos($tempo_total, $formato = '%02d:%02d') {
- if ($tempo_total < 1) {
- return;
- }
- $horas = floor($tempo_total / 60);
- $minutos = ($tempo_total % 60);
- return sprintf($formato, $horas, $minutos);
- }
- $pecas = 23;
- $tempo_unitario = 20;
- $tempo_total = $pecas * $tempo_unitario;
- echo converterHorasMinutos($tempo_total, '%02d horas %02d minutos');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement