Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Add Days to Current Date in JavaScript</title> </head> <body> <script> // Get current date var date = new Date(); document.write(date + "<br>"); // Add five days to current date date.setDate(date.getDate() + 5); document.write(date); </script> </body> </html>