var date=new Date();
var year="",month="",day="",week="",hour="",minute="",second="";
year=date.getYear();
month=date.getMonth()+1;
day=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=date.getHours();
minute=date.getMinutes();
second=date.getSeconds();
timetable.innerText=" "+year+"年"+month+"月"+day+"日"+hour+":"+minute+":"+second+" "+val;
【javascript】获得当前时间
最新推荐文章于 2024-11-16 14:11:26 发布