programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Tim Cooke
• Devaka Cooray
• Ron McLeod
• Jeanne Boyarsky
Sheriffs:
• Liutauras Vilda
• paul wheaton
• Junilu Lacar
Saloon Keepers:
• Tim Moores
• Stephan van Hulst
• Piet Souris
• Carey Brown
• Tim Holloway
Bartenders:
• Martijn Verburg
• Frits Walraven
• Himai Minh

# Converting millisecs to hour, minute, seconds.

Ranch Hand
Posts: 782
• Number of slices to send:
Optional 'thank-you' note:
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

Sheriff
Posts: 4313
• Number of slices to send:
Optional 'thank-you' note:
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();

Greenhorn
Posts: 1
• Number of slices to send:
Optional 'thank-you' note:
Just divide by 1000, 60 etc.

mister krabs
Posts: 13974
• Number of slices to send:
Optional 'thank-you' note:
hours = ms / (1000*60*60);
ms = ms % (1000*60*60);
minutes = ms / (1000*60);
ms = ms % (1000*60);
seconds = ms / 1000;

Pho Tek
Ranch Hand
Posts: 782
• Number of slices to send:
Optional 'thank-you' note:
Thank you all.
Pho.

 And when my army is complete, I will rule the world! But, for now, I'm going to be happy with this tiny ad: the value of filler advertising in 2021 https://coderanch.com/t/730886/filler-advertising