Convert any date format to yyyy/mm/dd – Javascript

alert(get_yyyy_mm_dd_date("10-05-2020 09:01:12"));
function get_yyyy_mm_dd_date(date) {
    var date = new Date(date);
    var dd = date.getDate();
    var mm = date.getMonth() + 1; //January is 0!
    var yyyy = date.getFullYear();

    if (dd < 10) {
        dd = '0' + dd;
    }
    if (mm < 10) {
        mm = '0' + mm;
    }
    return [yyyy, mm, dd].join('/');
}

 

+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0