You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
515 B
13 lines
515 B
3 months ago
|
function getTime(/** timestamp=0 **/) {
|
||
|
var ts = arguments[0] || 0;
|
||
|
var t, y, m, d, h, i, s;
|
||
|
t = ts ? new Date(ts * 1000) : new Date();
|
||
|
y = t.getFullYear();
|
||
|
m = t.getMonth() + 1;
|
||
|
d = t.getDate();
|
||
|
h = t.getHours();
|
||
|
i = t.getMinutes();
|
||
|
s = t.getSeconds();
|
||
|
// 可根据需要在这里定义时间格式
|
||
|
return y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d) + ' ' + (h < 10 ? '0' + h : h) + ':' + (i < 10 ? '0' + i : i) + ':' + (s < 10 ? '0' + s : s);
|
||
|
}
|