<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>날짜관련내장객체</title>

    <script src="date.js" type="text/javascript"></script>
    <script src="time.js" type="text/javascript"></script>
    <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 />");
       
       
        // 자바스크립트 확장
        // date.js 검색/다운로드 및 사용 ==> '날짜'관련(DateTime) 명령어
        var il = Date.getDaysInMonth(2008, 2 - 1); //
        document.write(il + "<br />");

       
        // 시간차 : TimeSpan ==> time.js 검색/ 다운로드 및 사용 ==> '시간차' 관련 명령어
        var now = Date.today();
        var birth = Date.parse("1982-02-05");
        var span = new TimeSpan(now - birth);
        document.write(span.getDays() + "일 살았습니다.");
    </script>
   
</head>
<body>

</body>
</html>

Posted by holland14
: