js获取当前时间(年,月,日,星期)

<script type="text/javascript">
                var date=new Date();
		document.write(date.toLocaleString());
		document.write("<br/>");
		document.write(date.getFullYear());
		document.write("<br/>");
		//返回的是0-11.
		document.write(date.getMonth()+1);
		document.write("<br/>");
		//返回的是0-6.其中周日是0.其余与周几的数字对应
		document.write(date.getDay());
		document.write("<br/>");
		document.write(date.getDate());
</script>

猜你喜欢

转载自blog.csdn.net/weixin_42331540/article/details/80508377
今日推荐