In Dojo javascript, after entering from date in a datetextbox , how do I add 4 months to that selected date and display it in a text box?
Any help on this will be valuable.
Asked
Active
Viewed 778 times
2
1 Answers
3
You can do this with the dojo.date tools:
var enteredDate = myDateTextBox.get("value"),
modifiedDate = dojo.date.add(enteredDate, "month", 4);
myTextBox.set("value", modifiedDate.toUTCString());
This assumes you have dojo.require("dojo.date");
. Take a look at http://dojotoolkit.org/api/1.7/dojo/date for an overview of Dojo's date functions.
It's not technically necessary to use Dojo for this at all, though. See this question: Javascript function to add X months to a date .