Java Long Number to Time getStrDateForLong(long time)

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

Description

get Str Date For Long

License

Apache License

Declaration

public static String getStrDateForLong(long time) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.DateFormat;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Main {
    /**yyyy-MM-dd HH:mm:ss*/
    private static DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public static String getStrDateForLong(long time) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(time);//w ww  .j a va2s  .c om
        return getDefaultFormatByDate(calendar.getTime());
    }

    public static String getDefaultFormatByDate(Date date) {
        return dateFormat.format(date);
    }
}

Related

  1. getServerTime(long offset)
  2. getShortTimeText(Long oldTime)
  3. getSimpleDate(long time)
  4. getSMillon(long time)
  5. getSpeedString(long castTime, long bytes)
  6. getTextDate(long timeInMs)
  7. getTime(long nanos)
  8. getTime(Long time)
  9. getTime(long time, boolean getTimeOnly, boolean fileSystemSafe)