Android Utililty Methods Milliseconds Calculate

List of utility methods to do Milliseconds Calculate

Description

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

Method

String[]millisecondsAfterNearestFifteenMinutes( String date, String time, int milliseconds)
milliseconds After Nearest Fifteen Minutes
Date d = dateTimeToDateObj(date, time);
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.setTime(d);
Time msAfter = new Time();
msAfter.set(cal.getTimeInMillis() + milliseconds);
msAfter = nearestFifteenMinutes(msAfter);
String[] oha = { msAfter.format("%m-%d-%Y"),
        msAfter.format("%I:%M %p").toUpperCase() };
...
String[]millisecondsAfter(String date, String time, int milliseconds)
milliseconds After
Date d = dateTimeToDateObj(date, time);
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.setTime(d);
Time msAfter = new Time();
msAfter.set(cal.getTimeInMillis() + milliseconds);
String[] oha = { msAfter.format("%m-%d-%Y"),
        msAfter.format("%I:%M %p").toUpperCase() };
return oha;
...
CharSequenceformatDuration(final Resources res, final long millis)
Return given duration in a human-friendly format.
if (millis >= HOUR_IN_MILLIS) {
    final int hours = (int) ((millis + 1800000) / HOUR_IN_MILLIS);
    return res.getQuantityString(R.plurals.duration_hours, hours,
            hours);
} else if (millis >= MINUTE_IN_MILLIS) {
    final int minutes = (int) ((millis + 30000) / MINUTE_IN_MILLIS);
    return res.getQuantityString(R.plurals.duration_minutes,
            minutes, minutes);
...
longgetMillisPerUnit(int unit)
Returns the number of milliseconds of a Calendar field, if this is a constant value.
long result = Long.MAX_VALUE;
switch (unit) {
case Calendar.DAY_OF_YEAR:
case Calendar.DATE:
    result = MILLIS_PER_DAY;
    break;
case Calendar.HOUR_OF_DAY:
    result = MILLIS_PER_HOUR;
...
longgetUTCTimeMillis()
get UTC Time Millis
return getUTCTimeFromLocalMillis(System.currentTimeMillis());
longgetTimeZoneOffsetInMillis()
get Time Zone Offset In Millis
Calendar cal = Calendar.getInstance();
return cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET);
introundMicrosToMillis(String micros)
round Micros To Millis
assert micros != null && micros.length() == 4;
double dblMicros = Integer.valueOf(micros).doubleValue();
return (int) Math.round(dblMicros / 10.0);
longcurrentDateMillis()
current Date Millis
return Calendar.getInstance().getTimeInMillis();