Java Minute timeFromMinutes(Long minutes)

Here you can find the source of timeFromMinutes(Long minutes)

Description

Converts a time interval from minutes to a minutes/hours time string.
I.E.: 123 > "2 h 3 min", 45 > "45 min"

License

Apache License

Parameter

Parameter Description
minutes the minutes to convert

Return

the time interval string

Declaration

public static String timeFromMinutes(Long minutes) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**//from  ww  w.  j  a  va  2s  . c o  m
     * Converts a time interval from minutes to a minutes/hours time string.<br/>
     * I.E.: 123 > "2 h 3 min", 45 > "45 min"
     *
     * @param minutes
     *            the minutes to convert
     * @return the time interval string
     */
    public static String timeFromMinutes(Long minutes) {
        if (minutes > 60) {
            Long hours = (long) Math.floor(minutes / 60);
            minutes -= hours * 60;
            return hours + " h " + minutes + " min";
        } else
            return minutes + " min";
    }
}

Related

  1. secsToMinutes(long secs)
  2. selectOfToday(int hour, int minute, int second, int millisecond)
  3. shortTimeToMinutes(String time)
  4. sleepToNextMinute()
  5. TimeDeltaString_JustMinutesSecs(long ms)
  6. toXMinutes(float t)
  7. travelTimeAt100kphInMinutes(double ODDist)