I am getting date of last n days from today by using a function -
function get_date_of_last_n_days_from_today(n){
return new Date(Date.now() - (n-1) * 24 * 60 * 60 * 1000);
}
SO if run above code to get the date of previous 3rd day from today (included) then I will use get_date_of_last_n_days_from_today(3)
But the output of above returns -
Sun Oct 31 2021 09:59:58 GMT+0530 (India Standard Time)
I want to convert output in only YYYY-MM-DD
How do I do this ?