Jump to content
View in the app

A better way to browse. Learn more.

Portal do Host

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Classe Php para trabalhar com tempo(segundos, minutos e etc) alguem conhece?

Featured Replies

pessoal gostaria de saber se alguem conhece alguma classe php para trabalhar com tempo por exemplo

100 = 1m40s

pois estava precisando faver este calculos e nao estou querendo desenvolver uma classe, queria saber se existe alguma pronta :D

obs: moderadores se estiver algo fora das regras por favor modifiquem o topico.




O php ja tem funções que fazem isto. Função Date por exemplo. date('formato', timestamp);


hackinho,

Acho que pra esse tipo de problema é mais fácil desenvolver uma classe do que achar uma pronta na internet. Vou esboçar uma aqui.


<?php


class Time {


public function __construct($seconds) { $this->value = $seconds; }

public function getMin() { floor($this->value/60); }

public function getSecondsRemaining() { $this->value % 60; }


// implemente as outras funções seguindo a base de cima, use floor e o operador módulo (%)


}


// exemplo de uso para o caso apresentado acima


$t = new Time(100);

echo $t->getMin() . "m" $t->getSecondsRemaining();


Não testei, mas é bem simples fazer isso!


  • Author

obrigado a todos. e obrigado ao amigo carrara.erle pois o tua classe serviu perfeitamente(so foi necessario alguns ajustes.

aproveitando gostaria que avaliacem este scrip que busca legendas de video do youtube ainda esta em desenvolvimento.

aceito criticas e sugestoes

http://youtubelegendas.host.org/


Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Important Information

Do you agree with our terms?

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.