Here you can find the source of minutesToTime(int inTime)
Parameter | Description |
---|---|
inTime | Time code to convert |
public static String minutesToTime(int inTime)
//package com.java2s; /*//from ww w.ja v a 2 s .co m Copyright 2013, 2014 Jason LaFrance This file is part of WTBBackend. WTBBackend is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WTBBackend is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with WTBBackend. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Convert a time code in minutes to a time String * * @param inTime * Time code to convert * @return The time String */ public static String minutesToTime(int inTime) { if (inTime < 0) { return ""; } int min = inTime % 60; inTime /= 60; int hour = inTime; String H = ("00" + Integer.toString(hour)); H = H.substring(H.length() - 2); String M = ("00" + Integer.toString(min)); M = M.substring(M.length() - 2); return H + ":" + M + ":00"; } }