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
      },

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM