Android Long to Date Convert getLabelForEventInTime(long inTime)

Here you can find the source of getLabelForEventInTime(long inTime)

Description

Returns a label for event happened inTime ms

Parameter

Parameter Description
intime when event shall be happened

Return

label for event happened inTime ms

Declaration

public static String getLabelForEventInTime(long inTime) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    private final static SimpleDateFormat formatter = new SimpleDateFormat(
            "dd/HH:mm:ss");

    /**/* w w w .  j  a v  a 2s.com*/
     * Returns a label for event happened <code>inTime</code> ms
     * 
     * @param intime
     *            when event shall be happened
     * @return label for event happened <code>inTime</code> ms
     */
    public static String getLabelForEventInTime(long inTime) {
        return android.text.format.DateUtils.getRelativeTimeSpanString(
                inTime, 0, 0)
                + " at "
                + getTimeLabel(inTime + System.currentTimeMillis());
    }

    /**
     * Returns label for the time.
     * 
     * @param time
     *            the time to return label for.
     * @return label for the time.
     */
    public static String getTimeLabel(long time) {
        return formatter.format(new Date(time));
    }
}

Related

  1. stringForTime(long timeMs)
  2. getTimeString(long millis)
  3. parseTime(long time, String pattern)
  4. getDateByInt(long va)
  5. getDateTimeString(long dateTime)
  6. getTimeDelta(long delta, String dateFormat)
  7. timeAgo(long aTime)
  8. isTomorrow(long lTime)
  9. getActivityTime(long startTime, long endTime)