Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] [OFF][JAVA] Formatar segundos para mm:ss

Valeu galera. Todas soluções são ótimas.
Estou usando a do primeiro email em minha app msm pois aproveito o formatter.

abs 


2014-02-27 19:21 GMT-03:00 Andre Souza <deh.osouza@gmail.com>:
http://stackoverflow.com/questions/5387371/how-to-convert-minutes-to-hours-and-minutes-hhmm-in-java


  int hours = t / 60; //since both are ints, you get an int  int minutes = t % 60;  System.out.printf("%d:%02d", hours, minutes);


2014-02-27 16:49 GMT-03:00 Pedro Subutzki <Pepeu> <falecompepeu@gmail.com>:

Fiz aqui na mão e testei rapidamente, vê se te ajuda:

Abraços,
Pedro Subutzki
__________________________________________
HADI - Makes SQLite in Android easy and simple
https://github.com/PepeuCps/Hadi


2014-02-27 16:47 GMT-03:00 Fred <fredferrao@gmail.com>:

boa, mas teria que zerar todo o calendar primeiro.


2014-02-27 15:46 GMT-04:00 Rafael de Araújo <orafaaraujo@gmail.com>:

int t = 125;
Calendar cal = Calendar.getInstance();
cal.clear();
cal.set(Calendar.SECOND, t);
System.out.println(new SimpleDateFormat("mm:ss").format(cal.getTime()));

Não sei se te ajuda...

Att,
Rafael de Araújo


2014-02-27 16:33 GMT-03:00 Gink Labrev <gink.labrev@gmail.com>:

Pessoal,

Tenho a variável:

int tempo = 125;

Como faço para colocá-la em uma String no formato:

02:05

Ou seja, dois minutos e cinco segundos. A variável tempo representa 125 segundos.

Tentei:

new SimpleDateFormat("hh:mm:ss").format(tempo);

Mas não funcionou.

Agradeço qq ajuda

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
"Frederico Ferrão da Silva"

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
André Luiz de Oliveira Souza
Engenheiro da Computação
Pós-graduado em Desenvolvimento de Software com ênfase em Java Corporativo

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário