I have the following question. I have to capture two dates, one being today and the other being 15 days behind. To get the date of the day I did the following.
function dateFormat() {
var initialDate = new Date(),
day = initialDate.getDate(),
month = initialDate.getMonth() + 1,
year = initialDate.getFullYear();
return (year * 10000) + (month * 100) + day; }
I can get today's date without problems, but how should I get a date 15 days ago. Being that there is the difference of days between the months.
Note that the return value in the function is due to the way I should send this date to the server, as it should be YYYYMMDD .