在vue的表格显示中,处理日期的时间格式

<el-table-column prop="报案注销时间" label="报案注销时间" width="170" :formatter="dateFormat"></el-table-column>
//表格中修改时间格式
      dateFormat(row, column, cellValue, index) { 
        const daterc = row[column.property]
        if (daterc != null) { 
          const dateMat = new Date(parseInt(daterc.replace("/Date(", "").replace(")/", ""), 10));
          const year = dateMat.getFullYear();
          const month = dateMat.getMonth() + 1;
          const day = dateMat.getDate();
          const hh = dateMat.getHours();
          const mm = dateMat.getMinutes();
          const ss = dateMat.getSeconds();
          const timeFormat = year + "/" + month + "/" + day + " " + hh + ":" + mm + ":" + ss;
          return timeFormat;
        }
      },
    原文作者:rikiemo
    原文地址: https://blog.csdn.net/kuguhuan/article/details/106546550
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞