1.将时间(2017-08-10)转换时间戳
var startTime = '2017-08-10';
var startdate = new Date(Date.parse(startTime.replace(/-/g, "/")));
startdate = startdate.getTime() / 1000;
alert(startdate)
2.将时间(2017-08-10 10:15:30)转换时间戳
var startTime = '2017-08-10 10:15:30';
var startdate = new Date(Date.parse(startTime.replace(/-/g, "/")));
startdate = startdate.getTime() / 1000;
alert(startdate)
3.时间(2017/08/10)转换时间戳
var times = '2017/08/10';
var old = (new Date(times)).getTime()/1000;
alert(old);
4.时间(2017/08/10 15:15:30)转换时间戳
var times = '2017/08/10 15:15:30';
var old = (new Date(times)).getTime()/1000;
alert(old);