如何使用JavaScript获取当月的第一个和最后一个日期?
要在JavaScript中获取当月的第一个和最后一个日期,您可以尝试运行以下代码-
<html>
<head>
<title>JavaScript Dates</title>
</head>
<body>
<script>
var date = new Date();
document.write("Current Date: " + date );
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
document.write("<br>"+firstDay);
var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
document.write("<br>"+lastDay);
</script>
</body>
</html>热门推荐
7 家长会简短祝福语
10 儿童励志寄语简短祝福语
11 春节红包祝福语大全简短
12 写给宝宝新年祝福语简短
13 离别赠言离职祝福语简短
14 艺校元旦祝福语大全简短
15 大哥添孙子简短祝福语
16 小托班祝福语简短
17 对当兵的祝福语简短
18 便利贴老师祝福语简短