Java examples for java.util:Second
format Duration in second
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { long seconds = 2; System.out.println(formatDuration(seconds)); }/*from ww w. java 2 s. co m*/ public static String formatDuration(long seconds) { return String.format("%02d:%02d:%02d", seconds / 3600, (seconds % 3600) / 60, (seconds % 60)); } }