Most idiomatic way to print a time difference in Java?

Posted by Zombies on Stack Overflow See other posts from Stack Overflow or by Zombies
Published on 2010-04-24T12:39:42Z Indexed on 2010/04/24 12:43 UTC
Read the original article Hit count: 416

I'm familiar with printing time difference in milliseconds:

 long time = System.currentTimeMillis();
 //do something that takes some time...
 long completedIn = System.currentTimeMillis() - time();

But, is there a nice way print a complete time in a specified format (eg: HH:MM:SS) either using Apache Commons or even the dreaded platform API's Date/Time objects? In other words, what is the shortest, simplest, no nonsense way to write this in Java?

© Stack Overflow or respective owner

Related posts about java

Related posts about datetime