Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- @Função: Converter tempo
- @Creditos: SuYaNw
- suyanwdacio.blogspot.com
- */
- function Calcular($numero, $tempo)
- {
- $var_tempo = 0;
- $string = "";
- $var_saida = 0;
- $out = "";
- switch($tempo)
- {
- case 0: $var_tempo = 1000; $string = "Segundo(s)"; break;// segundo
- case 1: $var_tempo = 60000; $string = "Minuto(s)"; break; // minuto
- case 2: $var_tempo = 3600000; $string = "Hora(s)"; break; // horida
- case 3: $var_tempo = 86400000; $string = "Dia(s)"; break; // dia
- case 4: $var_tempo = 86400000; $string = "Semana(s)"; break; // semana
- case 5: $var_tempo = 2592000000; $string = "Mes(es)"; break; // mes
- case 6: $var_tempo = 2592000000 * 12; $string = "Ano(s)"; break;// ano
- default: $var_tempo8 = 5;
- }
- if($var_tempo != 5)
- {
- $var_saida = $numero * $var_tempo;
- $out = $var_saida." ".$string;
- }
- else
- {
- $out = "Tempo inválido";
- }
- return $out;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement