年月日星期js代码

<span id="todayWeek"></span>
    <script type="text/javascript" charset="utf-8">
        var week = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
        var localToday = '';
        var d = new Date();
        var localToday = d.getFullYear() + "年" + (d.getMonth() + 1) + "月" + d.getDate() + "日";
        document.getElementById('todayWeek').innerHTML = "今日:" + localToday + "&nbsp;&nbsp;&nbsp;&nbsp;" + week[d.getDay()];
    </script>

posted @ 2017-03-07 09:54  xiaobei2016  阅读(2795)  评论(1编辑  收藏  举报