获取时间,时间的正常展示

Posted web-shu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了获取时间,时间的正常展示相关的知识,希望对你有一定的参考价值。

 /*获取时间*/
    getTime: function() {
      var _this = this;
      let yy = new Date().getFullYear();
      let mm = new Date().getMonth() + 1;
      let dd = new Date().getDate();
      let hh = new Date().getHours();
      let mf =
        new Date().getMinutes() < 10
          ? "0" + new Date().getMinutes()
          : new Date().getMinutes();
      let ss =
        new Date().getSeconds() < 10
          ? "0" + new Date().getSeconds()
          : new Date().getSeconds();
      _this.gettime = yy + "-" + mm + "-" + dd + " " + hh + ":" + mf + ":" + ss;
    },

 

以上是关于获取时间,时间的正常展示的主要内容,如果未能解决你的问题,请参考以下文章