Hello everyone, I am going to share the code
sample to get start date and end date of current month using JavaScript. All
the detail as given below.
The live demo link http://embed.plnkr.co/tO4vTm/preview
The
JavaScript code
<script>
var monthStartDay = new
Date(nowdate.getFullYear(), nowdate.getMonth(), 1);
var monthEndDay = new
Date(nowdate.getFullYear(), nowdate.getMonth() + 1, 0);
$(function () {
$("#startDate").html(monthStartDay);
$("#endDate").html(monthEndDay);
});
</script>
The output
look like this.
The Live
demo code sample to get
the month start date and end date in JavaScript as given below.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>
var nowdate = new Date();
var monthStartDay = new
Date(nowdate.getFullYear(), nowdate.getMonth(), 1);
var monthEndDay = new
Date(nowdate.getFullYear(), nowdate.getMonth() + 1, 0);
$(function () {
$("#startDate").html(monthStartDay);
$("#endDate").html(monthEndDay);
});
</script>
</head>
<body>
<h1>get month start date
and end date in JavaScript</h1>
<div>
Month StartDate : <label id="startDate" class="color"></label>
</div>
<div>
Month EndDate : <label id="endDate" class="color"></label>
</div>
</body>
</html>
The output : go to link http://embed.plnkr.co/tO4vTm/preview
Thank you!