vue elementUI组件时间转化方法

vue elementUI组件时间转化方法:

imeFormat(Time){
     
          var time = new Date(Time);
          var year = time.getFullYear();
          var month = time.getMonth()+1;
          var date = time.getDate();
          var hours = time.getHours();
          var minutes = time.getMinutes();
          var seconds = time.getSeconds();
          function add0(m){
     return m<10?'0'+m:m }
          var startTime = add0(year) + '-' + add0(month) + '-' + add0(date) + ' ' + add0(hours) + '-' + add0(minutes) + '-' + add0(seconds)
          return startTime
      },
      

使用:var startTime = this.dataTime[0];
          var endTime = this.dataTime[1];
          this.queryInfo.startTime = this.timeFormat(startTime);//开始时间
          this.queryInfo.endTime = this.timeFormat(endTime);//结束时间

你可能感兴趣的:(前端,JavaScript,element,ui,javascript,vue.js,前端)