How to add number of days to JavaScript Date?

JavascriptWeb DevelopmentFront End Technology

To add the number of days, use the Date() function to display the current date and then add two days

Example

Live Demo

<!DOCTYPE html>
<html>
   <body>
      <script>
         var date, incDate;
         date = new Date();
         document.write(date);

         var incDate = new Date(new Date().getTime()+(2*24*60*60*1000));
         document.write("<br>"+incDate);
      </script>
   </body>
</html>
raja
Updated on 13-Sep-2019 12:54:55

Advertisements