* * 示例:$.time('yyyy-MM-dd qq HH:mm:ss.S') * :$.time('yyyyMMddHHmmssS') * y:年 M:月 d:日 q:季 H:时 m:分 s:秒 S:毫秒 * 其中y可选0-4位占位符、S可选0-1位占位符,其余可选0-2位占位符 * @param {*} fmt 格式化参数 *
(fmt)
| 954 | * |
| 955 | */ |
| 956 | time(fmt) { |
| 957 | let o = { |
| 958 | 'M+': new Date().getMonth() + 1, |
| 959 | 'd+': new Date().getDate(), |
| 960 | 'H+': new Date().getHours(), |
| 961 | 'm+': new Date().getMinutes(), |
| 962 | 's+': new Date().getSeconds(), |
| 963 | 'q+': Math.floor((new Date().getMonth() + 3) / 3), |
| 964 | 'S': new Date().getMilliseconds() |
| 965 | } |
| 966 | if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (new Date().getFullYear() + '').substr(4 - RegExp.$1.length)) |
| 967 | for (let k in o) |
| 968 | if (new RegExp('(' + k + ')').test(fmt)) |
| 969 | fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)) |
| 970 | return fmt |
| 971 | } |
| 972 | |
| 973 | /** |
| 974 | * 系统通知 |
nothing calls this directly
no outgoing calls
no test coverage detected