函数可以把时间戳转成yyyy-mm-dd hh:mm:ss格式的时间
function dateFormat(timestamp) { var time = new Date(parseInt(timestamp)); var y = time.getFullYear(); var m = time.getMonth() + 1; m = m > 9 ? m : '0' + m; var d = time.getDate(); d = d > 9 ? d : '0' + d; var h = time.getHours(); h = h > 9 ? h : '0' + h; var mm = time.getMinutes(); mm = mm > 9 ? mm : '0' + mm; var s = time.getSeconds(); s = s > 9 ? s : '0' + s; return y + '-' + m + '-' + d + ' ' + h + ':' + mm + ':' + s; }