aspose file tools*
The moose likes Beginning Java and the fly likes Converting millisecs to hour, minute, seconds. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Converting millisecs to hour, minute, seconds." Watch "Converting millisecs to hour, minute, seconds." New topic
Author

Converting millisecs to hour, minute, seconds.

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

I have an interval of time in milliseconds.
Is there any utility to convert that
to an interval specified in
hour:minute:sec
Thanks
Pho


Regards,

Pho
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

I think you can use a combination of the java.util.Calendar and java.util.Date
Check out these methods in particular:
void Date.setTime(long time);
and
Date Calendar.getTime();


- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
Bob Smith
Greenhorn

Joined: May 17, 2002
Posts: 1
Just divide by 1000, 60 etc.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
hours = ms / (1000*60*60);
ms = ms % (1000*60*60);
minutes = ms / (1000*60);
ms = ms % (1000*60);
seconds = ms / 1000;


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

Thank you all.
Pho.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Converting millisecs to hour, minute, seconds.
 
Similar Threads
can you do that in one query?
setInterval and clearInterval functions
Notification sending in my project using JSP
How to reduce the resources consumed .......
Cewolf-labels