javascript parse date yyyy-mm-dd code example
Example 1: javascript convert date to yyyy-mm-dd
const formatYmd = date => date.toISOString().slice(0, 10);
formatYmd(new Date());
Example 2: js date format yyyy-mm-dd
yourDate.toISOString().split('T')[0]
Example 3: convert date format from yyyy-mm-dd to dd-mm-yyyy using value javascript
date.value.split("-").reverse().join("-");
Example 4: javascript date format dd-mm-yyyy
var date_format = new Date();
document.write(innerHTML = date_format.getMonth()+'-'+ date_format.getDate()+'-'+date_format.getFullYear());