long转date

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了long转date相关的知识,希望对你有一定的参考价值。

public static String toDate(long s) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日  HH:mm");
        // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
        Date date = new Date(s * 1000);
        return sdf.format(date);
    }

使用:
String d=CommUtil.toDate(Long.valueOf(list.get(position).create_time).longValue());

以上是关于long转date的主要内容,如果未能解决你的问题,请参考以下文章