Here you can find the source of formatSecondsToHHMM(long seconds)
Parameter | Description |
---|---|
seconds | - time in seconds |
public static String formatSecondsToHHMM(long seconds)
//package com.java2s; public class Main { /**/*w w w . j av a 2 s.co m*/ * Converts seconds into hours and minutes. * * @param seconds - time in seconds * @return String - in the form of <hours>h <minutes>min */ public static String formatSecondsToHHMM(long seconds) { long m = (seconds / 60) % 60; long h = (seconds / 60) / 60; String hhmm = ""; if (h > 0) { hhmm += h + "h"; } if (m > 0) { hhmm += " "; hhmm += m + "min"; } if (hhmm.length() < 1) { hhmm += "1min"; } return hhmm; } }