日期字符串转换
// 获取当前时间戳(以s为单位)
// 第一种方式
var timestamps = +new Date();
timestamps = timestamps / 1000;
// 第二种方式
var timestamp = Date.parse(new Date());
timestamp = timestamp / 1000;
// 第三种方式
var date = new Date("2014-07-10 10:21:12"); //时间对象
var str = date.getTime(); //转换成时间戳
str = str / 1000;
// 获取某个时间格式的时间戳
var stringTime = "2014-07-10 10:21:12";
var timestamp2 = Date.parse(new Date(stringTime));
timestamp2 = timestamp2 / 1000;