MCPcopy Index your code
hub / github.com/smallfawn/QLScriptPublic / time

Method time

tools/env.js:129–154  ·  view source on GitHub ↗
(t)

Source from the content-addressed store, hash-verified

127 );
128 }
129 time(t) {
130 let s = {
131 "M+": new Date().getMonth() + 1,
132 "d+": new Date().getDate(),
133 "H+": new Date().getHours(),
134 "m+": new Date().getMinutes(),
135 "s+": new Date().getSeconds(),
136 "q+": Math.floor((new Date().getMonth() + 3) / 3),
137 S: new Date().getMilliseconds(),
138 };
139 /(y+)/.test(t) &&
140 (t = t.replace(
141 RegExp.$1,
142 (new Date().getFullYear() + "").substr(4 - RegExp.$1.length)
143 ));
144 for (let e in s) {
145 new RegExp("(" + e + ")").test(t) &&
146 (t = t.replace(
147 RegExp.$1,
148 1 == RegExp.$1.length
149 ? s[e]
150 : ("00" + s[e]).substr(("" + s[e]).length)
151 ));
152 }
153 return t;
154 }
155
156 log(content) {
157 this.notifyStr.push(`[${this.time("HH:mm:ss")}]` + " " + this.toStr(content))

Callers 1

logMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected