일반 경과 시간 구하기

황제낙엽 2019.10.04 07:05 조회 수 : 1903

sitelink1 https://kin.naver.com/qna/detail.nhn?d1i...&spq=0 
sitelink2  
sitelink3  
sitelink4  
extra_vars4  
extra_vars5  
extra_vars6  

<html>

    <head>

        <title> 경과 시간 </title>

    </head>

<body>

    <script language = "javascript">

        var toDay = new Date();

        document.write("현재시간 : " + toDay.toLocaleString() + "<br/>");

        var fromDay = new Date(1945, 7, 15);

        strPeriod = toDay.getTime() - fromDay.getTime();

        pDay = strPeriod / (60*60*24*1000);

        strDay = Math.floor(pDay);

        pHour = (strPeriod - (strDay * (60*60*24*1000))) / (60*60*1000);

        strHour = Math.floor(pHour);

        strMinute = Math.floor((strPeriod - (strDay * (60*60*24*1000)) - (strHour * (60*60*1000))) / (60*1000));

        document.write("<B>우리나라가 독립한지<BR>" + strDay + " 일 " + strHour + " 시간 " + strMinute + " 분 되었습니다. </B>");

    </script>

</body>

</html>

번호 제목 글쓴이 날짜 조회 수
206 [GitHub] JavaScript Algorithms and Data Structures (알고리즘과 자료구조) file 황제낙엽 2021.03.01 891
205 콜백지옥과 비동기제어 file 황제낙엽 2021.02.18 1740
204 Json 특징 및 문법 황제낙엽 2021.01.26 756
203 비동기프로그래밍 - 콜백함수(Callback function) file 황제낙엽 2020.08.26 972
202 Strict 모드 황제낙엽 2020.08.23 1032
201 window.postMessage() 황제낙엽 2020.07.29 2434
200 withCredentials 관련 황제낙엽 2020.07.29 842
199 CORS 관련 레퍼런스 URL 황제낙엽 2020.07.10 961
198 ECMA 스크립트의 JSON 황제낙엽 2019.10.16 652
» 경과 시간 구하기 황제낙엽 2019.10.04 1903
196 입력받은 날짜와 현재 날짜와의 비교 함수 황제낙엽 2019.08.02 1214
195 사용자 모듈 만들기 황제낙엽 2019.07.09 42560
194 charcode 32와 160 차이 (javascript char 160 to 32) 황제낙엽 2019.05.11 735
193 UTF-8 한글 초성 추출 (자바스크립트) 황제낙엽 2019.05.07 1107
192 IE브라우저에서 서버의 XML파일을 ajax로 가져와 DOM파싱하는 예제 (XMLHttpRequest, XML, ActiveXObject) 황제낙엽 2018.11.23 1031
191 XMLHttpRequest.timeout 황제낙엽 2018.11.03 1223
190 부동소수점 (floating-point) file 황제낙엽 2018.03.26 1955
189 User Agent Parser들 황제낙엽 2017.11.20 8344
188 window.postMessage 이해하기 file 황제낙엽 2017.10.16 1904
187 브라우저의 새로고침과 종료에 대한 이벤트 황제낙엽 2017.08.11 3631