Blog Content

    티스토리 뷰

    32.JavaScript - 날짜관련내장객체

    반응형
    JavaScript의 날짜관련 예제입니다.







    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>날짜관련내장객체</title>
        <script type="text/javascript">
            //현재 시간을 출력
            var today = new Date();
            //출력
            document.write(today.getFullYear() + "<br/>");

            document.write((today.getMonth() + 1) + "<br/>");

            document.write(today.getDate() + "<br/>");

            document.write(today.getDay() + "<br/>"); //0요일~6요일까지
           
            document.write(today.getHours() + "<br/>");

            document.write(today.getMinutes() + "<br/>");

            document.write(today.getSeconds() + "<br/>");

            document.write(today.getMilliseconds() + "<br/>");
        </script>
    </head>
    <body>
    </body>
    </html>



    반응형

    Comments