get Time By Timestamp value in long - Android java.util

Android examples for java.util:Date Time

Description

get Time By Timestamp value in long

Demo Code

import android.text.TextUtils;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;

public class Main{
    public static final SimpleDateFormat format = new SimpleDateFormat(
            "yyyy-MM-dd HH:mm:ss");
    public static String getTimeByTimestamp(long time) {
        Date d = new Date(time);
        return format.format(d);
    }// ww  w .j  ava  2s  . com

}

Related Tutorials