Javascript date for next two weeks problem

Hello friends,

I have two text boxes and one text box i select calendar and i select particular date.After selecting the date In the next text box i have to add from that date to +21 days .
I know how to display from today to next 21 days or weeks. But if i select particular date in that first text box it should calculate automatically +21 days and display second text box

Thanks in advance
Its Urjent

LOL, help us help you!

What code are you using, what do you have so far, how are you loading the values, DOM?

Well, in case you are needing a JS routine to add days, here is one I found for you:

Date.prototype.addDays = function(days){
    var ms = new Date().getTime() + (86400000 * days);
    var added = new Date(ms);
    return added;
}

Since most sites say it is best to use milliseconds to be more accurate, this routine uses that option.
(It seems that if you use days, it can cause issues based on number of days in the month, leap years, etc.)

Hope that is what you are looking for…

Sponsor our Newsletter | Privacy Policy | Terms of Service