How to convert date to mysql format YYYY MM DD in JavaScript

Datetime
Last updated Dec 29, 2017
let date = new Date();

//YYYY-MM-DD format
date.toISOString().split("T")[0];
2017-12-29