Java Millisecond Convert millisToHMS(long millis)

Here you can find the source of millisToHMS(long millis)

Description

millis To HMS

License

Apache License

Declaration

public static String millisToHMS(long millis) 

Method Source Code

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

public class Main {
    public static String millisToHMS(long millis) {
        boolean minus = false;
        if (millis < 0) {
            minus = true;//from w  w  w  .j av a2 s .  c o m
            millis = -millis;
        }
        long s = millis / 1000;
        long m = s / 60;
        long h = m / 60;
        String hms = String.format("%02d:%02d:%02d", h, m % 60, s % 60);
        return minus ? "-" + hms : hms;
    }
}

Related

  1. millisToCycles(double millis, double hz)
  2. millisToDateString(Long Millis)
  3. millisToDays(long millis)
  4. millisToDuration(long millis)
  5. millisToDurationString(long millis)
  6. millisToHMSShort(long millis)
  7. millisToLongDHMS(long duration)
  8. millisToLongDHMS(long duration)
  9. millisToLongDHMS(long duration, String pubDate)