## 1. Javascript格式化時間戳函數
~~~
function formatTime(time, format) {
var data = new Date(time * 1000);
format = format.replace('y', data.getFullYear());
format = format.replace('m', data.getMonth() + 1);
format = format.replace('d', data.getDate());
format = format.replace('h', data.getHours());
format = format.replace('i', data.getMinutes());
format = format.replace('s', data.getSeconds());
return format;
}
~~~
## 2. 實例
~~~
var time = '1421661231';
alert(formatTime(time, 'y年m月d日 h:i:s'));
"2015年1月19日 17:53:51"
~~~
- Linux相關
- centos下源碼安裝redis的方法
- Nginx配置ThinkPHP的UrlRewrite和PathInfo模式
- Apache開啟 .htaccess & url_rewrite & vhost
- Ubuntu安裝服務器環境
- Virtual Box 和 Ubuntu Server 14.10 的共享文件
- www.hmoore.net服務器環境搭建
- Javascript相關
- Javascript導出Excel表格
- Javascript格式化時間戳
- 工具相關
- sublime text 3 安裝后要做的事
- 測試
- NetBeans默認使用utf8編碼打開文件方法
- sass安裝
- less安裝
- 各種查詢
- 蘋果常用軟件的url schemes查詢