vue 年月日时分秒毫秒
vue 年月日时分秒毫秒
var myDate = new Date();//时间实例
var H = myDate.getHours(); //获取小时
var M = myDate.getMinutes(); //获取分钟
var S = myDate.getSeconds();//获取秒
var MS = myDate.getMilliseconds();//获取毫秒
var milliSeconds = H * 3600 * 1000 + M * 60 * 1000 + S * 1000 + MS;
alert("当前时间的毫秒数为:" + milliSeconds);
let timeStamp = new Date();
let year = new Date(timeStamp).getFullYear();
let month = new Date(timeStamp).getMonth() + 1 < 10 ? "0" + (new Date(timeStamp).getMonth() + 1) : new Date(timeStamp).getMonth() + 1;
let date = new Date(timeStamp).getDate() < 10 ? "0" + new Date(timeStamp).getDate() : new Date(timeStamp).getDate();
let hh = new Date(timeStamp).getHours() < 10 ? "0" + new Date(timeStamp).getHours() : new Date(timeStamp).getHours();
let mm = new Date(timeStamp).getMinutes() < 10 ? "0" + new Date(timeStamp).getMinutes() : new Date(timeStamp).getMinutes();
let ss = new Date(timeStamp).getSeconds() < 10 ? "0" + new Date(timeStamp).getSeconds() : new Date(timeStamp).getSeconds();
let sss = new Date(timeStamp).getMilliseconds() < 10 ? "0" + new Date(timeStamp).getMilliseconds() : new Date(timeStamp).getMilliseconds();
this.form.caseId = year + month + date + hh + mm + ss + sss;
更多推荐
所有评论(0)