Time format processing "2023-04-20T06:19:52.000+0800"

function method 

    DateFormat (value) {
      var padDate = function (value) { return value < 10 ? '0' + value : value }
        var date = new Date(value);
        var year = date.getFullYear();
        var month = padDate(date.getMonth() + 1);
        var day = padDate(date.getDate());
        var hour = padDate(date.getHours());
        var min = padDate(date.getMinutes());
        var sec = padDate(date.getSeconds());
        return  `${year}-${month}-${day} ${hour}:${min}:${sec}`;
        },

display format in html5 

  <el-table-column label="编制时间" prop="createTime" :show-overflow-tooltip="true" align="center" >
        <template v-slot="{ row }">
        {
   
   {  DateFormat(row.createTime)  }}  
        </template>
      </el-table-column>

You can also use day.js or moment.js to handle  

Guess you like

Origin blog.csdn.net/weixin_69811594/article/details/130391833