You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
616 B
JavaScript
25 lines
616 B
JavaScript
2 years ago
|
const add0 = (m) => {
|
||
|
return m < 10 ? '0' + m : m
|
||
|
}
|
||
|
const FormatTiem = (A) => {
|
||
|
let timestamp = `
|
||
|
`
|
||
|
if (A) {
|
||
|
timestamp = A.split('(')[1].split(')')[0]
|
||
|
var time = new Date(timestamp/1000);
|
||
|
var y = time.getFullYear();
|
||
|
var m = time.getMonth() + 1;
|
||
|
var d = time.getDate();
|
||
|
var h = time.getHours();
|
||
|
var mm = time.getMinutes();
|
||
|
var s = time.getSeconds();
|
||
|
// console.log(y + '-' + add0(m) + '-' + add0(d) + ' ' + add0(h) + ':' + add0(mm) + ':' + add0(s));
|
||
|
return add0(m) + '-' + add0(d) + ' ' + add0(h) + ':' + add0(mm)
|
||
|
}
|
||
|
return timestamp
|
||
|
}
|
||
|
// export default {FormatTiem}
|
||
|
export {
|
||
|
FormatTiem
|
||
|
}
|