//时间转时间戳//时间转时间戳 function toTime(time) { var s = 0; var h = time.split(':')[0]; var m = time.split(':')[1]; var s = time.split(':')[2]; s = Number(h * 3600) + Number(m * 60) + Number(s); return s; },
// 时间转换function timeTo(timestamp) { var date = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000 var Y = date.getFullYear() + '-'; var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'; var D = date.getDate() + ' '; var h = date.getHours() + ':'; var m = date.getMinutes() + ':'; var s = date.getSeconds(); return Y + M + D + h + m + s; },