时间戳转时间格式(年:月:日:天:时:分)
formatDate:function(nows) {var date = new Date(nows);
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = m < 10 ? ('0' + m) : m;
var d = date.getDate();
d = d < 10 ? ('0' + d) : d;
var h = date.getHours();
h = h < 10 ? ('0' + h) : h;
var minute = date.getMinutes();
var second = date.getSeconds();
minute = minute < 10 ? ('0' + minute) : minute;
return y + '-' + m + '-' + d + '' + h +':' + minute;
},
时间格式转时间戳
var data = new Data(); // 获取当前时间
var gettime = date.getTime() // 转为时间戳
时间戳在线转换工具
在线转换工具