Java Second Get getTimeFromSeconds(int seconds)

Here you can find the source of getTimeFromSeconds(int seconds)

Description

get Time From Seconds

License

Open Source License

Declaration

public static String getTimeFromSeconds(int seconds) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String getTimeFromSeconds(int seconds) {
        if (seconds > 60) {
            int minutes = seconds / 60;
            seconds = seconds % 60;/* w w  w . j a v  a2  s  .  c  o  m*/
            if (minutes > 60) {
                int hours = minutes / 60;
                minutes = minutes % 60;
                if (hours > 24) {
                    int days = hours / 24;
                    hours = hours % 24;
                    return days + " days, " + hours + " hours, " + minutes + " minutes, " + seconds + " seconds";
                } else {
                    return hours + " hours, " + minutes + " minutes, " + seconds + " seconds";
                }
            } else {
                return minutes + " minutes, " + seconds + " seconds";
            }
        } else {
            return seconds + " seconds";
        }
    }
}

Related

  1. getSecondVersion(String buildId)
  2. getSYNTimeSeconds()
  3. getTextBeforeFirstAndSecondColumns(String s)
  4. getTimeAsSeconds(String value)
  5. GetTimeFromSeconds(double time)
  6. getTimeInSecondResolution(long timeMillis)
  7. getTimeSeconds(String time)
  8. getTimeStringFromSeconds(int totalSeconds)
  9. getTokenRenewIntervalInSeconds(int tokenValidityInSeconds)