Java Minute Convert minutesToTime(int inTime)

Here you can find the source of minutesToTime(int inTime)

Description

Convert a time code in minutes to a time String

License

Open Source License

Parameter

Parameter Description
inTime Time code to convert

Return

The time String

Declaration

public static String minutesToTime(int inTime) 

Method Source Code

//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";
    }
}

Related

  1. minutesToSecs(long minutes)
  2. minutesToShortTime(int minutes)
  3. minutesToString(Integer minutes)
  4. minutesToTicks(double x)
  5. minutesToTicks(int minutes)
  6. minuteToMillis(long minute)
  7. minuteToTime(int minute)
  8. onMinute(int minute)