JS 對其格式化 方法如下
function ChangeDateFormat(d){ //將時間戳轉為int類型,構造Date類型 var date = new Date(parseInt(d.time,10)); //月份得+1,且只有個位數時在前面+0 var month = date.getMonth() + 1 < 10 ?"0" + (date.getMonth() + 1) : date.getMonth() + 1; //日期為個位數時在前面+0 var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate(); //getFullYear得到4位數的年份 ,返回一串字符串 return date.getFullYear()+"-" +month +"-" +currentDate; }