methods: {
getCurrentTime() {
//获取当前时间并打印
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;
console.log(_this.gettime)
}
}
vue获取当前时间(年月日时分秒)
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 1.获取当前时间 2.获取时间中的年月日时分秒 3.时间的格式化 作者:折戟沉沙_wx来源:CSDN原文:http...
- 这篇文章主要介绍了js获取当前时间的年月日时分秒及时间的格式化,本文通过实例代码讲解的非常详细,具有一定的参考借鉴...