其他分享
首页 > 其他分享> > js获取年月日时分秒毫秒

js获取年月日时分秒毫秒

作者:互联网

getNowTime() { var date = new Date(); this.year = date.getFullYear(); this.month = date.getMonth() + 1; this.date = date.getDate(); this.hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(); this.minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(); this.second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds(); this.milliSeconds = date.getMilliseconds(); var currentTime = this.year+'-'+this.month + '-' + this.date + ' ' + this.hour + ':' + this.minute + ':' + this.second + '.' + this.milliSeconds; return currentTime; },

标签:getSeconds,getMinutes,10,getHours,js,毫秒,date,month,时分秒
来源: https://www.cnblogs.com/cl0327/p/15597289.html