Android Long to Date Convert getDateString(long time)

Here you can find the source of getDateString(long time)

Description

get Date String

Declaration

public static String getDateString(long time) 

Method Source Code

//package com.java2s;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {
    public static String getDateString(long time) {
        Calendar date = Calendar.getInstance();
        time = time * 1000;/*from www .jav  a  2  s .c  o m*/
        //long targetTime = time - TimeZone.getDefault().getRawOffset();
        date.setTimeInMillis(time);

        SimpleDateFormat dateformat = new SimpleDateFormat(
                "yyyy-MM-dd HH:mm");
        String dateString = dateformat.format(date.getTime());
        return dateString;
    }
}

Related

  1. fullFromUtc(long milliseconds)
  2. generateFileName(long sysTime)
  3. getDateForMillis(final long tick)
  4. getDateLabel(long date)
  5. getDateString(long date, int style, Locale locale)
  6. getDateTime(long microsecond)
  7. getDateTime(long microsecond)
  8. getDateTimeForTimeZone(Long time)
  9. getDateTimeLabel(long time)