zoukankan      html  css  js  c++  java
  • 判断当天是周几

        function showTime() {
            var day = new Date();
            var year = day.getFullYear();
            var month = day.getMonth() + 1;
            var date = day.getDate();
            var days = day.getDay();
            var hours = day.getHours();
            var minutes = day.getMinutes();
            var second = day.getSeconds();
            switch (days) {
                case 1:
                    rs = '一';
                    break;

                case 2:
                    rs = '二';
                    break;

                case 3:
                    rs = '三';
                    break;

                case 4:
                    rs = '四';
                    break;

                case 5:
                    rs = '五';
                    break;

                case 6:
                    rs = '六';
                    break;

                case 7:
                    rs = '日';
                    break;

            }
            document.getElementById("nine").innerHTML = '今天是' + year + '年' + month + '月' + date + '日' + '星期' + rs


            + hours + '时' + minutes + '分' + second + '秒'
        }
        window.onload = showTime

  • 相关阅读:
    自我学习而已——javascript——变量,作用域和内存问题
    自我学习而已——javascript——数据类型部分
    面向对象三大特性之封装
    面向对象三大特性之继承与多态
    初识面向对象
    python常用模块(re模块)
    递归函数与算法
    Python之匿名函数
    python之内置函数
    各种推导式
  • 原文地址:https://www.cnblogs.com/xiaoleidiv/p/3396877.html
Copyright © 2011-2022 走看看