将yyyy-MM-dd hh:mm:ss转换为时间戳
// 转为时间戳//2014-07-10 10:21:12的时间戳为:1404958872 zhuanhuan(stringTime){ // var stringTime = "2014-07-10 10:21:12"; var timestamp2 = stringTime.replace(/-/g, '/') //为了兼容IOS,需先将字符串转换为'2018/9/11 9:11:23' timestamp2 = Date.parse(timestamp2) //返回'2018-9-12 9:11:23'的时间戳 console.log(stringTime + "的时间戳为:" + timestamp2); return timestamp2; },