1 PrefixInteger(num, length) {
2 return (Array(length).join('0') + num).slice(-length);
3 }
4 public toformatTime(time) {
5 let date, year, month, day, hour, minute;
6 date = new Date(time * 1000);
7 if (time === 0) {
8 date = new Date();
9 }
10 year = date.getFullYear();
11 month = this.PrefixInteger(date.getMonth() + 1, 2);
12 day = this.PrefixInteger(date.getDate(), 2);
13 hour = this.PrefixInteger(date.getHours(), 2);
14 minute = this.PrefixInteger(date.getMinutes(), 2);
15 return `${year}-${month}-${day}T${hour}:${minute}`;
16 }