Android Long to Date Convert getDateFrom(long timestamp, Context context)

Here you can find the source of getDateFrom(long timestamp, Context context)

Description

get Date From

Declaration

public static String getDateFrom(long timestamp, Context context) 

Method Source Code

//package com.java2s;

import java.util.Date;

import android.content.Context;
import android.text.format.DateFormat;

public class Main {
    public static String getDateFrom(long timestamp, Context context) {
        if (timestamp <= 0)
            return "";

        return DateFormat.getDateFormat(context).format(
                getDateFromLong(timestamp));
    }//from   w  w w .ja v a2s  .c om

    public static Date getDateFromLong(long dateLong) {
        if (dateLong == 0) {
            return null;
        }
        return new Date(dateLong);
    }
}

Related

  1. getTimeDelta(long delta, String dateFormat)
  2. timeAgo(long aTime)
  3. isTomorrow(long lTime)
  4. getActivityTime(long startTime, long endTime)
  5. getDate(long timeStamp)
  6. getDateFromLong(long dateLong)
  7. getDateTimeString(long time_milis)
  8. formatTime(long timeInMillis)
  9. formatDate(long timeInMillis)