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
Published on 29-Jan-2018 14:25:19
Advertisements