const formatDate = seconds => { | |
const secondsNumber = parseInt(seconds, 10); | |
| let hours = Math.floor(secondsNumber / 3600); | |
| let minutes = Math.floor((secondsNumber - hours * 3600) / 60); | |
| let totalSeconds = secondsNumber - hours * 3600 - minutes * 60; | |
| if (hours < 10) { | |
| hours = `0${hours}`; | |
| } | |
| if (minutes < 10) { | |
| minutes = `0${minutes}`; | |
| } | |
| if (totalSeconds < 10) { | |
| totalSeconds = `0${totalSeconds}`; | |
| } | |
| return `${hours}:${minutes}:${totalSeconds}`; | |
| }; | |
'개발 > Web Programming' 카테고리의 다른 글
| fetch json파싱하는법 (0) | 2019.10.21 |
|---|---|
| Git add, commit, push 되돌리기~ (0) | 2019.10.18 |
| Chromium원정대 (0) | 2019.10.08 |
| ESlint 설정 (0) | 2019.10.04 |
| BEM이란? (What is BEM) (0) | 2019.10.03 |