List of utility methods to do Millisecond Convert
long | toMillis(long nanos) Convert the specified number of nanoseconds to number of milliseconds, ignoring the fractional part of the result. return nanos / NS_TO_MS;
|
int | toMilliSeconds(float t) to Milli Seconds return (int) (t * 1000); |
double | toMilliseconds(long nanoseconds) Converts nanoseconds to milliseconds return toMilliseconds((double) nanoseconds); |
Double | toMilliseconds(long nanoSeconds) to Milliseconds return nanoSeconds / MILLISECONDS;
|
long | toMilliseconds(long second) to Milliseconds return 1000L * second;
|
long | toMilliseconds(long seconds, long nanos) to Milliseconds long result = seconds * 1000; result += nanos / 1000000; long temp = nanos % 1000000; if (temp > 0) result++; return result; |
long | toMilliseconds(Object value) Converts a string to a milliseconds long, interpreting 'ms', 's', 'm', 'h' and 'd' suffixes. if (value == null) return 0L; if (value instanceof Number) return ((Number) value).longValue(); else { String s = value.toString(); if (s.endsWith("ms")) return (long) Float.parseFloat(s.substring(0, s.length() - 2)); ... |
long | toMillisFromNanos(long nanos) to Millis From Nanos return nanos / THOUSAND;
|
long[] | toMillisInfo(long ms) to Millis Info long hour, minute, second; hour = ms / 1000 / 60 / 60; minute = (ms - hour * 60 * 60 * 1000) / 1000 / 60; second = ms / 1000 - hour * 60 * 60 - minute * 60; return new long[] { hour, minute, second }; |
String | toMillisToDayTime(long mill) to Millis To Day Time String timeString = ""; mill = mill / 1000; 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; |