zhou.xiaoning 4 år sedan
förälder
incheckning
92699c313f

+ 5 - 3
RMA/app/src/main/java/cn/muchinfo/rma/global/utils/VIewUtils.java

@@ -1,14 +1,16 @@
 package cn.muchinfo.rma.global.utils;
 
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Locale;
 
 public class VIewUtils {
 
 
-    public static String getShowTime(String timeString,String format) {
-        SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.CHINA);
-        return sdf.format(timeString);
+    public static String getShowTime(String timeString, String desFormat, String srcFormat) throws ParseException {
+        SimpleDateFormat sdf_src = new SimpleDateFormat(srcFormat, Locale.CHINA);
+        SimpleDateFormat sdf_des = new SimpleDateFormat(desFormat, Locale.CHINA);
+        return sdf_des.format(sdf_src.parse(timeString));
     }
 
 }

+ 7 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/exposure/ExposureDetailsContentAdapter.java

@@ -17,6 +17,7 @@ import androidx.recyclerview.widget.RecyclerView;
 import com.blankj.utilcode.util.TimeUtils;
 import com.blankj.utilcode.util.ToastUtils;
 
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -83,7 +84,12 @@ public class ExposureDetailsContentAdapter extends RecyclerView.Adapter<Exposure
     public void onBindViewHolder(@NonNull final ItemViewHolder itemViewHolder, int i) {
         this.index = i;
         if ("1".equals(type)){//现货头部左侧
-            itemViewHolder.exposure_tvLeftTitle.setText(VIewUtils.getShowTime(datas.get(i).getCreatetime(),"MMdd HH:mm"));
+
+            try {
+                itemViewHolder.exposure_tvLeftTitle.setText(VIewUtils.getShowTime(datas.get(i).getCreatetime(),"MM-dd HH:mm", "yyyy-MM-dd HH:mm:ss"));
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
             itemViewHolder.exposure_tv_left_bottom_title.setText(getType(datas.get(i).getContracttype(),datas.get(i).getLogtype()));
         }else if ("2".equals(type)){//期货头部左侧
             itemViewHolder.exposure_tvLeftTitle.setText(datas.get(i).getGoodsname());