// 将时分秒转为时间戳
function time_to_sec(time) {
if (time !== null) {
var s = '';
var hour = time.split(':')[0];
var min = time.split(':')[1];
var sec = time.split(':')[2];
s = Number(hour * 3600) + Number(min * 60) + Number(sec);
return s;
}
}
// 日期转为时间戳 - IOS兼容性
var time = '2021-05-20 00:00:00';
var repTime = aa.replace(/-/g, '/'); // 用正则转换分割线兼容ios
console.log("返回时间:" + repTime);
var timeTamp = Date.parse(repTime);
console.log("返回时间戳:" + timeTamp)