Flowers4Algernon Posted October 1, 2022 Report Share Posted October 1, 2022 Hello! Just wanted to share this simple JS code that I have used to show the First and Last day of the current month: <p id="date1"></p> <p id="date2"></p> <script> var date = new Date(); var firstDay = new Date(date.getFullYear(), date.getMonth(), 1); var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0); document.getElementById("date1").innerHTML = "First day = " + firstDay; document.getElementById("date2").innerHTML = "Last day = " + lastDay; </script> Quote Link to comment Share on other sites More sharing options...
Flowers4Algernon Posted October 1, 2022 Author Report Share Posted October 1, 2022 I also have found another solution that may work: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.