스크립트로 날짜 차이를 계산 하려고 하는데 질문 드립니다.
본문
let current_date = new Date();
tran_current_date = current_date.setSeconds( current_date.getSeconds() + 60);
console.log('current_date ..= ' + tran_current_date);
console.log('date ..= ' + date);
=== 결과
current_date ..= 1593405808586
date ..= 1592004960000
current_date 와 date 의 값을 분으로 환산후 차이를 계산 하려고 하는데
저런 상태의 값을 분으로 바꾸려면 어떻게 해야 하나요?
timestamp에 millisecond가 붙은거 같아서 대충 이런식으로 계산을 해보았는데
(tran_current_date/1000 - date/1000) / 60
1318.3782833337784 이렇게 값이 나온다면 몇분이란 걸까요?
답변 1
...
오류 수정한 상태로 (현재에서 60초 더한 시각 - 현재 시각)/1000/60 하면 "분"이 나옵니다.
정상적이라면 "1"이 나오겠죠?
개발자 도구, Console 창을 열고 "오류"를 찾아보세요.
* PHP스쿨, SIR 모두 EOA 처리.
답변을 작성하시기 전에 로그인 해주세요.