|
-
Jul 31st, 2001, 05:19 AM
#1
Thread Starter
Member
Format milliseconds
How do you format a number of milliseconds into hours, minutes, & seconds? Example, if I have a time of 67149 milliseconds, how can I change that into 1 min 7 secs??
-
Jul 31st, 2001, 10:34 AM
#2
Dazed Member
I think you can do it like this. I tried to format from currentTimeMillis(); but i was having trouble. I just woke up and i need my daily caffeine fix.
import java.util.Date;
import java.text.DateFormat;
class Timer{
public static void main(String[] args){
// returns the current time in milliseconds since midnight GMT
// January 1,1970 GMT
//long end = System.currentTimeMillis();
DateFormat longTime = DateFormat.getTimeInstance(DateFormat.LONG);
String time = longTime.format(new Date());
System.out.println(time);
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|