How To Get Current Month First Day in JavaScript?
Jul 30, 2021 . Admin

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>How to get current month first day in javascript?</title> </head> <body> <script type="text/javascript"> function startOfMonth(date) { return new Date(date.getFullYear(), date.getMonth(), 1); } dt = new Date(); console.log(startOfMonth(dt).toString()); </script> </body> </html>Output:
Thu Jul 01 2021 00:00:00 GMT+0530 (India Standard Time)Example: 2
<html> <head> <title>How to get current month first day in javascript?</title> </head> <body> <script> var date = new Date(); var firstDay = new Date(date.getFullYear(), date.getMonth(), 1); document.write("<br>"+firstDay); </script> </body> </html>Output:
Thu Jul 01 2021 00:00:00 GMT+0530 (India Standard Time)
It will help you....