Java Utililty Methods Millisecond Format

List of utility methods to do Millisecond Format

Description

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

Method

StringformattedMillis(long millis)
formatted Millis
String format = String.format("%%0%dd", 2);
long elapsedTime = millis / 1000;
String hours = String.format(format, elapsedTime / 3600);
elapsedTime %= 3600;
String minutes = String.format(format, elapsedTime / 60);
elapsedTime %= 60;
String seconds = String.format(format, elapsedTime);
String time = hours + ":" + minutes + ":" + seconds;
...
StringformatTime(long currentTimeMillis)
format Time
return DateFormat.getTimeInstance(DateFormat.MEDIUM).format(new Date(currentTimeMillis));
StringformatTime(long localCreationTimeMillis)
format Time
Date date = getTempDate();
date.setTime(localCreationTimeMillis);
return m_dateFormatWithMillis.format(date);
StringformatTime(long millis)
Returns a string representation of the specified time value in hh:mm:ss.SSS format in the local time zone.
SimpleDateFormat f = new SimpleDateFormat(TIME_FORMAT_HH_MM_SS_SSS);
return f.format(new Date(millis));
StringformatTime(long millis)
format Time
return time.get().format(new Date(millis));
StringformatTimeInMillis(long millis)
Formats a delta time.
StringBuilder b = new StringBuilder();
long u = 0;
while (millis > 0) {
    if (b.length() != 0) {
        b.append(' ');
    if (millis > WEEK_MILLIS) {
        u = millis / WEEK_MILLIS;
...
StringformatTimeMillis(long millis)
format Time Millis
long seconds = millis / 1000;
return String.format("%s.%03d", formatTime(seconds), millis % 1000);
StringformatTimeMillis(long timeMillis)
Converts the passed duration in millisecands to a hour, min, sec, millisec string.
long milliSec = timeMillis % kilo;
long secAll = timeMillis / kilo;
long sec = secAll % SEC_IN_MIN;
long minAll = secAll / SEC_IN_MIN;
long min = minAll % MIN_IN_H;
long h = minAll / MIN_IN_H;
return h + " h - " + min + " min - " + sec + " s - " + milliSec + " ms";
StringformatTimestamp(long millis)
Returns a string representation of the specified timestamp value in yyyy-mm-dd hh:mm:ss.SSS format in the local time zone.
SimpleDateFormat f = new SimpleDateFormat(TIMESTAMP_FORMAT_YYYY_MM_DD_HH_MM_SS_SSS);
return f.format(new Date(millis));
StringformatTimeWithMillis(double time)
format Time With Millis
int hours = (int) time / 3600;
int minutes = (int) (time - (hours * 3600)) / 60;
int seconds = (int) time - (hours * 3600) - (minutes * 60);
double millis = time - (hours * 3600) - (minutes * 60) - seconds;
String hoursString = hours + "";
String minutesString = minutes + "";
String secondsString = seconds + "";
String millisString = new DecimalFormat(".000").format(millis);
...