Updated and fixed my answer:
In my own Time4J library (v1.2), a template-based solution, ready for Java 6 and later, looks like this:
Duration<?> dur =
Duration.of(37540, ClockUnit.SECONDS).with(Duration.STD_CLOCK_PERIOD);
String s = Duration.Formatter.ofPattern("hh:mm:ss").format(dur);
System.out.println(s);
In Joda-Time, the following code is possible using the builder approach:
PeriodFormatter f =
new PeriodFormatterBuilder().appendHours().appendLiteral(":").appendMinutes()
.appendLiteral(":").appendSeconds().toFormatter();
System.out.println("Joda-Time: " + f.print(new Period(37540 * 1000)));
( SECOND_OF_DAY), , 86400 ( ). , . Java-8 ( - JSR-310) - . :
input = 337540 seconds (almost 4 days)
code of accepted solution => 21:45:40 (WRONG!!!)
Time4J-v1.2 => 93:45:40
Joda-Time => 93:45:40
, .