Ata
Ata

Reputation: 12564

convert MediaPlayer time to DataFormated

is there any way to convert durtion of MediaPlayer that is in long to String .

long is 500271 which equales 08:20  

how can I convert this long to this type of formated text , also be careful that you may have hours.

Upvotes: 0

Views: 187

Answers (1)

5hssba
5hssba

Reputation: 8079

If "is" is your time in milliseconds

 long t=is/1000;
 int h=0;
int min=t/60;
  if(min>60)
 {
  h=min/60;
  min=min%60;
 }
 int sec=t%60;
 String time="time="h":"+min+":"+sec

Upvotes: 1

Related Questions