Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Set the Date Value of a Date Object</title> </head> <body> <script> var d = new Date(2018, 5, 24); // June 24, 2018 d.setDate(15); // Sets date to 15, new date will be June 15, 2018 document.write(d); </script> </body> </html>