-2

Possible Duplicate:
How to convert Milliseconds to “X mins, x seconds” in Java?

Hello I need convert in JSP file long value that show number of milliseconds to format mm:ss

<td>${values.parameters.timeLong}</td>
Community
  • 1
  • 1
lugaru
  • 21
  • 3

2 Answers2

0

A simple solution is to use SimpleDateFormat (with a format of "mm.ss"). I would perhaps do this on the server and provide the JSP with a pre-rendered value.

Beware that this class isn't thread-safe and a better alternative is available via Joda-Time

Brian Agnew
  • 268,207
  • 37
  • 334
  • 440
0

Too bad.. its too easy..

 x = input/ 1000;
    minutes = x % 60;
    seconds = x - ( minutes * 60 )

This will be faster than using SimpleDateFormat

Deepak Singhal
  • 10,568
  • 11
  • 59
  • 98