//获取当前时间并且格式化输出
    getTime(){
      let date1=new Date();
      let year=this.appendZero(date1.getFullYear());
      let month=this.appendZero(date1.getMonth()+1)
      let day=this.appendZero(date1.getDate());
      let hours=this.appendZero(date1.getHours());
      let minutes=this.appendZero(date1.getMinutes());
      let seconds=this.appendZero(date1.getSeconds());
      return year+"-"+month+"-"+day+" "+hours+":"+minutes+":"+seconds
    },
    //过滤补0
    appendZero(obj) {
      if (obj < 10) {
        return "0" + obj;
      } else {
        return obj;
      }
    },

 时间戳转标准日期格式:

filters: {
      formatDate: function (value) {
        let date = new Date(value*1000); //根据后端传来的时间戳精确度来判断是否需要*1000;一般是不用的
        let y = date.getFullYear();
        let MM = date.getMonth() + 1;
        MM = MM < 10 ? ('0' + MM) : MM;
        let d = date.getDate();
        d = d < 10 ? ('0' + d) : d;
        let h = date.getHours();
        h = h < 10 ? ('0' + h) : h;
        let m = date.getMinutes();
        m = m < 10 ? ('0' + m) : m;
        let s = date.getSeconds();
        s = s < 10 ? ('0' + s) : s;
        return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
      }
    },

 

长风破浪会有时,直挂云帆济沧海