如何使用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>热门推荐
10 俄语祝福语贺卡文案简短
11 学生宴祝福语简短的
12 给干爸过年祝福语简短
13 送给老师中秋祝福语简短
14 周年蛋糕祝福语简短英语
15 新年的鸡汤祝福语简短
16 新年酒席开席祝福语简短
17 周一情人祝福语简短
18 简短的祝福语12字