Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Set the Month Value of a Date Object</title> </head> <body> <script> var d = new Date(); // Current date and time d.setMonth(0); // Sets month to 0, January document.write(d); </script> </body> </html>