Java Utililty Methods Millisecond Convert

List of utility methods to do Millisecond Convert

Description

The list of methods to do Millisecond Convert are organized into topic(s).

Method

StringmillisToHMSShort(long millis)
millis To HMS Short
boolean minus = false;
if (millis < 0) {
    minus = true;
    millis = -millis;
String hms = millisToHMS(millis);
int i;
for (i = 0; i < hms.length() - 1; i++) {
...
StringmillisToLongDHMS(long duration)
converts time (in milliseconds) to human-readable format " days, hours, minutes and (z) seconds"
return millisToLongDHMS(duration, true);
StringmillisToLongDHMS(long duration)
millis To Long DHMS
StringBuffer res = new StringBuffer();
long temp = 0;
if (duration >= ONE_SECOND) {
    temp = duration / ONE_DAY;
    if (temp > 0) {
        duration -= temp * ONE_DAY;
        res.append(temp).append(" day").append(temp > 1 ? "s" : "")
                .append(duration >= ONE_MINUTE ? ", " : "");
...
StringmillisToLongDHMS(long duration, String pubDate)
millis To Long DHMS
StringBuffer res = new StringBuffer();
long temp = 0;
if (duration >= ONE_SECOND) {
    temp = duration / ONE_DAY;
    if (temp > 0) {
        duration -= temp * ONE_DAY;
        res.append(pubDate);
        return res.toString();
...
StringmillisToLongM(long duration)
millis To Long M
StringBuffer res = new StringBuffer();
long temp = 0;
if (duration >= ONE_SECOND) {
    temp = duration / ONE_MINUTE;
    duration -= temp * ONE_MINUTE;
    res.append(temp).append(" minute").append(temp > 1 ? "s" : "");
    return res.toString();
} else {
...
longmillisToNanos(final long millis)
Converts the provided number of milliseconds to nanoseconds.
return Math.max(0L, (millis * 1_000_000L));
longmillisToNanos(int i)
millis To Nanos
return i * nanosInMillisecond;
longmillisToNanos(long millis)
Convert milliseconds time to nanoseconds
return millis * nanosPerMilli;
longmillisToNanos(long millis)
millis To Nanos
return millis * 1000000L;
longmillisToSecond(long millisecond)
millis To Second
return millisecond / MILLISECOND_IN_SECOND;