首页 > 其他 > 详细

Date对象

时间:2019-04-21 22:45:33      阅读:117      评论:0      收藏:0      [点我收藏+]
<!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>

Date对象

原文:https://www.cnblogs.com/001yjk/p/10747355.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!