(timestamp)
| 164 | } |
| 165 | |
| 166 | export function timestamp2string(timestamp) { |
| 167 | let date = new Date(timestamp * 1000); |
| 168 | let year = date.getFullYear().toString(); |
| 169 | let month = (date.getMonth() + 1).toString(); |
| 170 | let day = date.getDate().toString(); |
| 171 | let hour = date.getHours().toString(); |
| 172 | let minute = date.getMinutes().toString(); |
| 173 | let second = date.getSeconds().toString(); |
| 174 | if (month.length === 1) { |
| 175 | month = '0' + month; |
| 176 | } |
| 177 | if (day.length === 1) { |
| 178 | day = '0' + day; |
| 179 | } |
| 180 | if (hour.length === 1) { |
| 181 | hour = '0' + hour; |
| 182 | } |
| 183 | if (minute.length === 1) { |
| 184 | minute = '0' + minute; |
| 185 | } |
| 186 | if (second.length === 1) { |
| 187 | second = '0' + second; |
| 188 | } |
| 189 | return ( |
| 190 | year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second |
| 191 | ); |
| 192 | } |
| 193 | |
| 194 | export function timestamp2string1(timestamp, dataExportDefaultTime = 'hour') { |
| 195 | let date = new Date(timestamp * 1000); |
no outgoing calls
no test coverage detected