首页 > 代码库 > long转date

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