Format date with "/" to "-" with javascript : <p>I have this Javascript function that takes X number of days and returns a date in the past</p>

<pre><code> var GetDateInThePastFromDays = function (days) {

        var today = new Date();
        _date = new Date(today.getFullYear(), today.getMonth(), today.getDate() - days);

        return _date.toLocaleDateString();
    }
</code></pre>

<p>That works absolutely fine, but it returns the date as <code>06/01/2016</code> but I want it returned as <code>06-01-2016</code> but I can't seem to find out how to do it correctly.</p>
