I\'d like to format a duration in seconds using a pattern like H:MM:SS. The current utilities in java are designed to format a time but not a duration.
long duration = 4 * 60 * 60 * 1000; SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS", Locale.getDefault()); log.info("Duration: " + sdf.format(new Date(duration - TimeZone.getDefault().getRawOffset())));