//格式化时间 function time_format(time) { return new Date(parseInt(time) * 1000).toLocaleString().replace(/:d{1,2}$/,' '); } time_format(20158645);
function get_unix_time(dateStr) { var newstr = dateStr.replace(/-/g,'/'); var date = new Date(newstr); var time_str = date.getTime().toString(); return time_str.substr(0, 10); } get_unix_time("1970-8-22 15:37");