Android Utililty Methods Long to Date Convert

List of utility methods to do Long to Date Convert

Description

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

Method

StringmillisToLongDHMS(long duration)
converts time (in milliseconds) to human-readable format " days, hours, minutes and (z) seconds"
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 ? ", " : "");
...
StringmillisToShortDHMS(long duration)
converts time (in milliseconds) to human-readable format "hh:mm:ss"
String res = "";
duration /= ONE_SECOND;
int seconds = (int) (duration % SECONDS);
duration /= SECONDS;
int minutes = (int) (duration % MINUTES);
duration /= MINUTES;
int hours = (int) (duration % HOURS);
int days = (int) (duration / HOURS);
...
DatenextDate(long timeMilliSeconds)
next Date
return nextDate(new Date(timeMilliSeconds));
StringparseMills2Time(long elapsedMills)
parse Mills Time
return parseInt2Time(Integer.parseInt(elapsedMills + ""));
StringshortFromUtc(long milliseconds)
Convert to "HH:mm:ss"
Date date = dateFromUtc(milliseconds);
synchronized (HOURS_MINUTES_SECONDS) {
    return HOURS_MINUTES_SECONDS.format(date);
StringtimeInMillisToText(final long totalTimeInMillis)
time In Millis To Text
final long minutes = (totalTimeInMillis / (1000 * 60)) % 60;
final long hours = totalTimeInMillis / (1000 * 60 * 60);
final String hoursWord = getHoursWord(Long.valueOf(hours)
        .intValue());
final String minutesWord = getMinutessWord(Long.valueOf(minutes)
        .intValue());
return hours + " " + hoursWord + ", " + minutes + " " + minutesWord;
StringtimeInMillisecondsToDateStringFull( long timeInMilliseconds)
time In Milliseconds To Date String Full
SimpleDateFormat formatter = new SimpleDateFormat(
        DEFAULT_FORMAT_PATTERN);
Date date = timeInMillisecondsToDate(timeInMilliseconds);
formatter.format(date);
return formatter.format(date);
DatetimestampToDate(long timeStamp)
timestamp To Date
return new java.util.Date(timeStamp * 1000);
DatetimestampToDate(long timeStamp)
timestamp To Date
return new java.util.Date(timeStamp * 1000);
StringtimestampToISO8601(long aTime)
timestamp To ISO
return timestampToISO8601(new Date(aTime));