Date对象

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Date对象</title>
</head>
<body>
    <script>
        //构建对象
        var date = new Date()
        //获取年份
        var fullyear = date.getFullYear();
        document.write(fullyear)
        document.write("<br/>")
        //获取月份(取值范围为0~11)
        var month = date.getMonth();
        month = month + 1
        document.write(month)
        document.write("<br/>")
        //取这个月的几号
        var dayofmonth = date.getDate()
        /*   getDay();
           getHours();
           getSeconds();
           getMilliseconds();*/
        document.write(dayofmonth)
    </script>
</body></html>
原文地址:https://www.cnblogs.com/001yjk/p/10747355.html