Q: Formatting android milliseconds I need a String format of a date like this " 3.456" (3 seconds and 456 milliseconds) but the milliseconds its not working
gameStart is filled when the game begin with System.currentTimeMillis();
loopStart = System.currentTimeMillis();
long prueba = loopStart-gameStart;
puntuacionString = (String) DateFormat.format("mm.ss.SSS", prueba);

It return something like "00.01.SSS" on the first second, what I m doing wrong?

A: Try same format with SimpleDateFormat as
SimpleDateFormat formatter = new SimpleDateFormat("mm.ss.SSS");
loopStart = System.currentTimeMillis();
long prueba = loopStart-gameStart;
puntuacionString = formatter.format(new Date(prueba));


A: DateFormat.format does not recognise the .SSS formatting option. You have to use use the SimpleDateFormat object, as that supports formatting data the way you want it. Try instantiating it and passing in your time to format, like so:
loopStart = System.currentTimeMillis();
long prueba = loopStart-gameStart;
SimpleDateFormat date = new SimpleDateFormat("mm.ss.SSS");
puntuacionString = date.format(prueba);

