Android Long to Date Convert converTime(long timestamp, String[] timeLabels)

Here you can find the source of converTime(long timestamp, String[] timeLabels)

Description

conver Time

Declaration

public static String converTime(long timestamp, String[] timeLabels) 

Method Source Code

//package com.java2s;

public class Main {
    public static String converTime(long timestamp, String[] timeLabels) {
        long currentSeconds = System.currentTimeMillis() / 1000;
        long timeGap = currentSeconds - timestamp;
        String timeStr = null;/*from w w  w  .  java 2 s  .  com*/
        if (timeGap > 24 * 60 * 60) {
            timeStr = timeGap / (24 * 60 * 60) + timeLabels[0];
        } else if (timeGap > 60 * 60) {
            timeStr = timeGap / (60 * 60) + timeLabels[1];
        } else if (timeGap > 60) {
            timeStr = timeGap / 60 + timeLabels[2];
        } else {
            timeStr = timeLabels[3];
        }
        return timeStr;
    }
}

Related

  1. GetDate(long milliseconds)
  2. convToEnglishTime(long dateMsec)
  3. convertNotNull(Long long1)
  4. convertToDateStamp(long time)
  5. convertToTimeStamp(long time)
  6. convertToTimeStamp(long time, boolean showSeconds)