Android Long to Date Convert longTimeToString(int i)

Here you can find the source of longTimeToString(int i)

Description

long Time To String

Declaration

public static String longTimeToString(int i) 

Method Source Code

//package com.java2s;

public class Main {
    public static String longTimeToString(int i) {
        StringBuilder sb = new StringBuilder();
        i = i / 1000;/*  w  w w  .  ja v a2 s  . c  om*/
        int m = i / 60;
        int s = i % 60;
        if (i >= 60) {
            if (m < 10) {
                sb.append("0");
                sb.append(String.valueOf(m));
            } else {
                sb.append(String.valueOf(m));
            }
            sb.append(":");
            if (s > 9) {
                sb.append(String.valueOf(s));
            } else {
                sb.append("0");
                sb.append(String.valueOf(s));
            }
        } else {
            sb.append("00:");
            if (s > 9) {
                sb.append(String.valueOf(s));
            } else {
                sb.append("0");
                sb.append(String.valueOf(s));
            }
        }
        return sb.toString();
    }
}

Related

  1. isAtMostNMonthsAgo(long date, int howMany)
  2. isAtMostNWeeksAgo(long date, int howMany)
  3. isYesterday(long date)
  4. isYesterday(long date)
  5. longTimeToDate(long miliseconds)
  6. longToCalendar(Long time)
  7. longToSqlDateFormat(long date)
  8. millisToLongDHMS(long duration)
  9. millisToShortDHMS(long duration)