Here you can find the source of minutesToHuman(int minutes)
Parameter | Description |
---|---|
minutes | The duration in minutes |
public static String minutesToHuman(int minutes)
//package com.java2s; /**//from w w w . ja v a 2 s . c o m * DateTimeUtils.java * * A utility class for converting dates to common formats * * @author Robin Andersson, Johan Brook * @copyright (c) 2012 Robin Andersson, Johan Brook, Mattias Henriksson, Lisa Stenberg * @license MIT */ public class Main { private final static int HOUR = 60; /** * Convert duration in minutes to a more human readable form. * * @param minutes * The duration in minutes * @return A string on the format "HH:mm" */ public static String minutesToHuman(int minutes) { int remainingMinutes = minutes % HOUR; int hours = minutes / HOUR; return hours + ":" + ((remainingMinutes < 10) ? "0" + remainingMinutes : remainingMinutes); } }