1var today = new Date();
2var dd = String(today.getDate()).padStart(2, '0');
3var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
4var yyyy = today.getFullYear();
5
6today = mm + '/' + dd + '/' + yyyy;
7document.write(today);
1// `date` is a `Date` object
2const formatYmd = date => date.toISOString().slice(0, 10);
3
4// Example
5formatYmd(new Date()); // 2020-05-06
1DateParts = data.split("/");
2
3new Date(+DateParts[2], DateParts[1] - 1, +DateParts[0]).setUTCHours(
4 0,
5 0,
6 0,
7 0
8 )