var s = '1379934802'; //php time()函数输出的时间戳 var d = new Date(parseInt(s) * 1000); //必须乘以1000,否则出现NaN var dateStr = d.getFullYear()+'-'+(d.getMonth()+1)+'-'+d.getDate(); alert(dateStr);