new Date时间戳格式-转换yyyy-MM-dd

      formatDate(date) {
        var year = date.getFullYear()
        var month = this.format(date.getMonth() + 1)
        var da = this.format(date.getDate())
        // var h = this.format(date.getHours())
        // var m = this.format(date.getMinutes())
        // var s = this.format(date.getSeconds())
        // return year + '-' + month + '-' + da + ' ' + h + ':' + m + ':' + s
        return year + '-' + month + '-' + da
      },
      format(val) {
        return Number(val) < 10 ? '0' + val : '' + val
      },

  

原文地址:https://www.cnblogs.com/fdxjava/p/12515790.html