1. 程式人生 > >long型別時間轉換string

long型別時間轉換string

long commentTime = list.get(position).getCommentTime();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT+00:00"));
// time為轉換格式後的字串
String time = simpleDateFormat.format(new Date(commentTime));
holder.textView5.setText(time + "");