日期转换格式

/*var date = new Date(1398250549490);
Y = date.getFullYear() + '-';
M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
D = date.getDate() + ' ';
h = date.getHours() + ':';
m = date.getMinutes() + ':';
s = date.getSeconds();
console.log(Y+M+D+h+m+s); //呀麻碟
//输出结果:2014-04-23 18:55:49*/

原文地址:https://www.cnblogs.com/lin-dong/p/6902848.html