//第一种
 2 function getLocalTime(nS) {     
 3    return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');     
 4 }     
 5 alert(getLocalTime(1293072805));
 6 //结果是2010年12月23日 10:53
 7 //第二种    
 8 function getLocalTime(nS) {     
 9     return new Date(parseInt(nS) * 1000).toLocaleString().substr(0,17)
10 }     
11 alert(getLocalTime(1293072805));
12 //第三种  格式为:2010-10-20 10:00:00
13     function getLocalTime(nS) {     
14        return new Date(parseInt(nS) * 1000).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ");      
15     }     
16     alert(getLocalTime(1177824835));

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-08
  • 2021-12-09
  • 2022-02-04
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-20
  • 2022-12-23
  • 2021-11-28
  • 2021-11-28
  • 2021-11-28
  • 2022-12-23
相关资源
相似解决方案