注意: js 时间日期只识别 "2016/05/24" 格式
//日期转时间戳 var end = "2016-05-24"; end = end.replace(/-/g,'/'); var end_date = new Date(end); var time = end_date.getTime();
//日期格式转换 var newDate = "2016/05/24"; var newDate = new Date(newDate); newDate.format('yyyy-MM-dd');
//时间戳生成日期
var time = time.getTime() - 1000*60*60*24; var d = new Date(time); //根据时间戳生成的时间对象 var date = (d.getFullYear()) + "-" + (d.getMonth() + 1) + "-" + (d.getDate())
注意:js时间是毫秒 php中是秒