急求一个标准北京时间的源代码,要连日期的,我要插入到自己的网页!如题 谢谢了
答案:1 悬赏:40 手机版
解决时间 2021-03-23 15:38
- 提问者网友:ミ烙印ゝ
- 2021-03-23 02:56
急求一个标准北京时间的源代码,要连日期的,我要插入到自己的网页!如题 谢谢了
最佳答案
- 五星知识达人网友:罪歌
- 2021-03-23 03:14
<script language="JavaScript"> <!-- function get_time(){ var date = new Date(); var year = "", month = "", day = "", week = "", hour = "", minute = "", second = ""; year = date.getYear(); month = add_zero(date.getMonth() + 1); day = add_zero(date.getDate()); week = date.getDay(); switch (date.getDay()){ case 0: val = "星期天"; break case 1: val = "星期一"; break case 2: val = "星期二"; break case 3: val = "星期三"; break case 4: val = "星期四"; break case 5: val = "星期五"; break case 6: val = "星期六"; break } hour = add_zero(date.getHours()); minute = add_zero(date.getMinutes()); second = add_zero(date.getSeconds()); time_div.innerText = year + "年" + month + "月" + day + "日" + hour + ":" + minute + ":" + second + " " + val; } function add_zero(temp){ if(temp < 10) return "0" + temp; else return temp; } setInterval("get_time()", 1000); //--> </script> <font class="w12"><b> <div id="time_div"></div> </b></font>
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯