javascript 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 parse yyyy-mm-dd
var dateString = "10/23/2015";
var dateObject = new Date(dateString);
document.body.innerHTML = dateObject.toString();