Web Analytics Made Easy -
StatCounter adding days to a specified date - CodingForum


No announcement yet.

adding days to a specified date

  • Filter
  • Time
  • Show
Clear All
new posts

  • adding days to a specified date

    apparently, i need help again.
    im almost finished with my project(not school related)
    I need to add one more thing to my website. A "date granted" input and a "date due" input. I have learned how to get no. of days between two dates and now i have to do kinda reverse of that. ive tried so but to no luck!
    The date granted input will be filled in by the user, the 'days to add' will be a value that will be derived from a selected option box so i cant just add + 10 (days ) in my script.
    I've searched the internet but so far, all i get was how to add days on the day today and not on a specified date.
    Please help.
    Thank you very much!

  • #2
    Just create a new date with the specified date, then add the days:

    var myDate = new Date();
    more examples can be found here: http://www.w3schools.com/js/js_obj_date.asp


    • #3
      thanks but i have looked into that before i posted.

      the first date is set in the script, the one i need is to get the date filled in by the user. The date format is mm-dd-yy so i thought maybe i have to use math.abs for that but i cant figure it out. im looking for an alternative.

      im looking for something like this:

      var dgranted=document.form1.dgranted.value;
      var term=document.form1.term.value;

      document.form1.ddue.value = (dgranted + term);

      pardon the format, i hope i expressed what i mean well enough.