过滤器:function trans(key) { return key < 10 ? ('0' + key) : key } var data = new Date(val); var y = data.getFullYear(); var m = trans(data.getMonth() + 1); var d = trans(data.getDate()); var hour = trans(data.getHours()); var min = trans(data.getMinutes()); var sec = trans(data.getSeconds()); return y + '-' + m + '-' + d + ' ' + hour + ':' + min + ':' + sec;