Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Specify the Month Value Outside of the Range</title> </head> <body> <script> var d = new Date(2018, 5, 24); // June 24, 2018 d.setMonth(12); // Sets month to 12, new date will be January 24, 2019 document.write(d); </script> </body> </html>