Java Millisecond Convert toMillisToDayTime(long mill)

Here you can find the source of toMillisToDayTime(long mill)

Description

to Millis To Day Time

License

Apache License

Declaration

public static String toMillisToDayTime(long mill) 

Method Source Code

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

public class Main {

    public static String toMillisToDayTime(long mill) {
        String timeString = "";
        mill = mill / 1000;//from  ww w.j  a  v  a  2s .  c om
        int days = (int) (mill / 60 / 60 / 24);
        if (days > 0) {
            timeString += days + " Day ";
        } else {
            timeString += 0 + " Day ";
        }
        int dayTime = days * 24 * 60 * 60;
        int hours = (int) ((mill - dayTime) / 60 / 60);
        if (hours < 10) {
            timeString += "0" + hours + ":";
        } else {
            timeString += hours + ":";
        }
        int minutes = (int) ((mill - dayTime - hours * 60 * 60) / 60);
        if (minutes < 10) {
            timeString += "0" + minutes + ":";
        } else {
            timeString += minutes + ":";
        }
        int seconds = (int) (mill % 60);
        if (seconds < 10) {
            timeString += "0" + seconds;
        } else {
            timeString += seconds;
        }
        return timeString;
    }
}

Related

  1. toMilliseconds(long second)
  2. toMilliseconds(long seconds, long nanos)
  3. toMilliseconds(Object value)
  4. toMillisFromNanos(long nanos)
  5. toMillisInfo(long ms)
  6. toMillisToHHMMSSTime(long timeMillis)
  7. toMillisToKKMMSSTime(long mill)