Btjson博客 Btjson博客

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

in 技术文章 read (619) 文章转载请注明来源!
/*获取当前日期信息*/
        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 + "日&nbsp;星期" + week[day] + "&nbsp;" + h + ":" + m + ":" + s;
            return str;
        }
jrotty WeChat Pay

微信打赏

jrotty Alipay

支付宝打赏

文章二维码

扫描二维码,在手机上阅读!

本文基于《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权
文章链接:https://www.pohaier.com/2018/08/17/68.html (转载时请注明本文出处及文章链接)

技术文章
发表新评论
博客已萌萌哒运行
© 2019 由 btjson 强力驱动.Theme by BTjson
PREVIOUS NEXT
雷姆
拉姆