时间戳的使用

	//创建一个   private String format;;
   long time = list.get(position).getCreateTime();

    myViewHolder.time.setText(timeStamp2Date(time, format));
    public static String timeStamp2Date(long time, String format) {
    if (format == null || format.isEmpty()) {
        format = "yyyy-MM-dd HH:mm:ss";
    }
    SimpleDateFormat sdf = new SimpleDateFormat(format);
    return sdf.format(new Date(time));
}

你可能感兴趣的:(时间戳的使用)