Click here to Skip to main content
15,851,242 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
in java script how to write a function for selecting next 30 days in end date based on the start date
Posted

1 solution

You can try like this.

C#
var txtstartDate = $("#txtStartDate").val(); //gets start date in say dd/MM/yyyy format
var datearray = txtstartDate.split("/");
var date = datearray[0];

//Add 30 day here --Overflow will be handeled automatically
date = parseint(date) + 30;

var mm = datearray[1];
var yyyy = datearray[2];

var endDate =  new Date(date,mm,yyyy);

//Now set this as the last range date in your date picker.


JavaScript

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900