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

Datetime
By Jad Joubran · 
Last updated Dec 01, 2019
const date = new Date();

//YYYY-MM-DD format
const mysqlDate = date.toISOString().split("T")[0];
2019-12-01