Java Utililty Methods Milliseconds

List of utility methods to do Milliseconds

Description

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

Method

voidappendMillis(int millis, StringBuilder builder)
append Millis
builder.append(".");
if (millis < 100)
    builder.append('0');
if (millis < 10)
    builder.append('0');
builder.append(millis);
StringcalcDate(long millisecs)
calc Date
String timezone = "UTC";
SimpleDateFormat date_format = new SimpleDateFormat("MMM dd yyyy HH:mm:ss.SSS");
date_format.setTimeZone(TimeZone.getTimeZone("timezone"));
Date resultdate = new Date(millisecs);
return date_format.format(resultdate) + " " + timezone;
longcalculateDaysBackIntoMilliseconds(Integer value)
rechnet Tage (Integer) in Millisekunden zurück und gibt eine long wert zurueck
return (long) value.intValue() * 24 * 3600 * 1000;
StringcalculateHMSFromMilliseconds(long timeInMilliSeconds)
Converts the time in seconds into hours, minutes and seconds.
return calculateHMS((int) (timeInMilliSeconds / 1000), false);
longcomputeEclipseTimeMilliseconds(final long beginTime)
compute Eclipse Time Milliseconds
return System.currentTimeMillis() - beginTime;
StringconcatMillis(String name)
concat Millis
return name + System.currentTimeMillis();
DateCreateDate(long milliseconds)
Convenience method for creating a date object.
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(milliseconds);
return cal.getTime();
CalendarcreateFromMillis(long milliseconds)
create From Millis
Calendar c = Calendar.getInstance();
c.setTimeInMillis(milliseconds);
return c;
StringcsvAnnotatedMilliString(long totaltime)
csv Annotated Milli String
return "" + totaltime + " ms, " + totaltime / 1000 + " sec, " + totaltime / (60 * 1000) + " min, "
        + totaltime / (60 * 60 * 1000) + " hrs";
longcutoffTimeMillis(long time)
Cutoff milliseconds from a time value
return (long) Math.floor(((double) time) / 1000) * 1000;