Date.prototype.format = function(format){ var o = { "M+" : this.getMonth()+1, //month "d+" : t ...
使用方法: 第一個參數是個obj對象,當前只能是時間對象或者是時間字符串 第二個參數是格式化字符串,和C 格式化規則一樣,除了周的格式化,這里使用了 E 來格式化周幾 這里是頁面調用例子: app.Tools.dateFormat yyyy MM dd 結果 app.Tools.dateFormat yyyy MM dd HH:mm:ss 結果 : : app.Tools.dateFormat ...
2017-07-19 14:18 2 4253 推薦指數:
Date.prototype.format = function(format){ var o = { "M+" : this.getMonth()+1, //month "d+" : t ...
JS的時間格式化和時間戳轉換函數 ...
// 對Date的擴展,將 Date 轉化為指定格式的String // 月(M)、日(d)、小時(h)、分(m)、秒(s)、季度(q) 可以用 1-2 個占位符, // 年(y)可以用 1-4 個占位符,毫秒(S)只能用 1 個占位符(是 1-3 位的數字 ...
common.DateFormater = function (dt, formater) { //author: meizz if (dt) { if ((typeof dt) == "strin ...
let start = formatTime('yyyy-mm-dd hh:mm', '2019-05-01T09:00:00') // 2019-05-01 09:00 兼容了safari new Date('2019-05-01T09:06:08') 改為 ...
function getMyDateTime(str){ var oDate = new Date(str), oYear = oDate.getFullYear(), oMonth = oDa ...
注:非原著 屬於借鑒 ...