这是在适配器里的代码
@Override
protected void convert(BaseViewHolder helper, WalletBean.ResultBean.DetailListBean item) {
helper.setText(R.id.wallet_child_money,item.getAmount()+"");
long createTime = item.getConsumerTime();
String date = stampToDate(createTime);
helper.setText(R.id.wallet_child_time,date);
}
//转换方法
public static String stampToDate(long s){
String res;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//如果它本来就是long类型的,则不用写这一步
long lt = new Long(s);
Date date = new Date(lt);
res = simpleDateFormat.format(date);
return res;
}