I have a timestamp in milliseconds and I want to convert this to hours, minutes, seconds but in the below format only:
20hrs 10mins 50sec
I wanted to come up with some better format of reading the data so decided to use above one. I am using DurationFormatUtils class from Apache Commons to give me result in this format HH:mm:ss,SSS as of now:
DurationFormatUtils.formatDuration(durationForStep, "HH:mm:ss,SSS")
Is there any way I can use DurationFormatUtils class only yo get the result in my above format? If not then I think manual work will be the only other option I guess?
I haven't used this, but according to the javadoc shouldn't you be able to just do the following?
DurationFormatUtils.formatDuration(durationForStep, "HH'hrs' mm'mins' ss'sec'");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With