一.時間轉換時間戳 
復制代碼 代碼如下:
 
function transdate(endTime){ 
var date=new Date(); 
date.setFullYear(endTime.substring(0,4)); 
date.setMonth(endTime.substring(5,7)-1); 
date.setDate(endTime.substring(8,10)); 
date.setHours(endTime.substring(11,13)); 
date.setMinutes(endTime.substring(14,16)); 
date.setSeconds(endTime.substring(17,19)); 
return Date.parse(date)/1000; 
} 
復制代碼 代碼如下:
 
function getDate(tm){ 
var tt=new Date(parseInt(tm) * 1000).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ") 
return tt; 
} 
復制代碼 代碼如下:
 
function getDate(tm){ 
var tt=new Date(parseInt(tm) * 1000).toLocaleString() 
return tt; 
} 
復制代碼 代碼如下:
 
function getDate(tm){ 
var tt=new Date(parseInt(tm) * 1000).toLocaleString().substr(0,16); 
return tt; 
} 
新聞熱點
疑難解答
圖片精選