I have this Javascript function that takes X number of days and returns a date in the past
var GetDateInThePastFromDays = function (days) {
var today = new Date();
_date = new Date(today.getFullYear(), today.getMonth(), today.getDate() - days);
return _date.toLocaleDateString();
}
That works absolutely fine, but it returns the date as 06/01/2016
but I want it returned as 06-01-2016
but I can't seem to find out how to do it correctly.