获取当前浏览器的当前时间,包括时、分、秒(可用作倒计时)

/*获取当前日期信息*/
        getDayTime: function () {
            var d = new Date();
            var year = d.getFullYear();
            var month = d.getMonth() + 1;
            var date = d.getDate();
            var day = d.getDay();
            var h = d.getHours();
            var m = d.getMinutes();
            var s = d.getSeconds();
            if (h < 10) { h = "0" + h; }
            if (m < 10) { m = "0" + m; }
            if (s < 10) { s = "0" + s; }
            var week = ["日", "一", "二", "三", "四", "五", "六"];
            //var str = year + "年" + month + "月" + date + "日 星期" + week[day] + " " + h + ":" + m + ":" + s;
            return str;
        }

你可能感兴趣的:(web前端开发,倒计时秒杀)