List of utility methods to do Millisecond Convert
long | millisecsToSecs(long millisecs) Converts millisecs to secs (Round down). return millisecs / 1000;
|
String | milliSecsToTime(double current, double max, double buffer) milli Secs To Time int currentSec = (int) (current / 1000); int maxSec = (int) (max / 1000); int bufPer = Math.min((int) ((buffer * 100) / max), 100); return String.format("%3d:%02d /%3d:%02d [%3d%%]", Integer.valueOf(currentSec / 60), Integer.valueOf(currentSec % 60), Integer.valueOf(maxSec / 60), Integer.valueOf(maxSec % 60), Integer.valueOf(bufPer)); |
String | milliSecToString(final long mS) Returns the given time in milliseconds formatted as Hours:Min:Sec.mSec final long rem_mS = (long) (mS % 1000.0); final long rem_sec = (long) ((mS / 1000.0) % 60.0); final long rem_min = (long) ((mS / 60000.0) % 60.0); final long hr = (long) (mS / 3600000.0); final String mSstr = zeroPad(Long.toString(rem_mS), 3); final String secStr = zeroPad(Long.toString(rem_sec), 2); final String minStr = zeroPad(Long.toString(rem_min), 2); return String.format("%d:%2s:%2s.%3s", hr, minStr, secStr, mSstr); ... |
String | milliSecToTime(double millis) milli Sec To Time int sec = (int) (millis / 1000); return String.format("%3d:%02d", Integer.valueOf(sec / 60), Integer.valueOf(sec % 60)); |
long | millisToCycles(double millis, double hz) millis To Cycles return (long) (hz * millis / 1000); |
String | millisToDateString(Long Millis) millis To Date String Date date = millisToDate(Millis);
return getFormat(datetimeFormat).format(date);
|
long | millisToDays(long millis) millis To Days return millis / 1000 / 60 / 60 / 24;
|
String | millisToDuration(long millis) millis To Duration long seconds = millis / 1000; if (seconds > 0) { millis -= seconds * 1000; return seconds + "." + millis; |
String | millisToDurationString(long millis) Given a number of milliseconds, product a string of the format 7d6h6m.21s StringBuilder sb = new StringBuilder(); if (millis < 0) { sb.append('-'); millis = -(millis); long val = millis / 86400000L; if (val > 0L) { sb.append(val).append('d'); ... |
String | millisToHMS(long millis) millis To HMS boolean minus = false; if (millis < 0) { minus = true; millis = -millis; long s = millis / 1000; long m = s / 60; long h = m / 60; ... |