I’m trying to create a booking button where’s it should get the current date put it on “from” and would add 5 days to put it in “To” day.
so it looks something like this.
$(function() {
$('#booknow').click(function() {
fromDate = getCurrentDate(); //DD/MM/YYYY
toDate = fromDate + 5;
url = 'http:domain.com/' + fromDate + ToDate + 'moreParameters=1;';
window.location = url;
});
}
});
BOOK NOW
I’m using jquery.datepick.min.js
How am I able to achieve this?
Edit:
hmm.. Any ideas what’s wrong here: http://jsbin.com/ociweb
You can create a Date instance five days after another one like this:
The “setter” functions on the JavaScript Date prototype know how to interpret such things such that setting the day-of-month to something like 35 correctly leaves you with a date in the following month.
edit — if all you want is a URL as in your question, formed with the present date and the date five days from today, then: