Data requested in vue: timestamp conversion time

Here is the
Insert picture description here
key part of converting the timestamp to the string in the data requested by vue

//item.add_time  为请求数据中的时间戳
var date = new Date(parseInt(item.add_time) * 1000);

  item.add_time = `${
      
      date.getFullYear()}/${
      
      date.getMonth() + 1}/${
      
      date.getDay()}
     ${
      
      date.getHours()}:${
      
      date.getMinutes()}:${
      
      date.getSeconds()}`;

Guess you like

Origin blog.csdn.net/ZiChen_Jiang/article/details/108567735