Get current date in format yyyy-mm-dd with Javascript

Saf Bes
1 min readNov 20, 2019

--

Format JavaScript date as yyyy-mm-dd
Get current date in format yyyy-mm-dd with Javascript

To get the current date in javascript, I use Intl.DateTimeFormat

new Intl.DateTimeFormat("fr-CA", {year: "numeric", month: "2-digit", day: "2-digit"}).format(Date.now())

the expected output :

2019-11-20

--

--