skip to Main Content

JavaScript convert date format to "YYYY-MM-DD"

I have a JavaScript string date: js code: const lastDayDate = new Date(selectedDate.getFullYear(), selectedDate.getMonth() + 1, 0); const options = { year: 'numeric', month: '2-digit', day: '2-digit' }; const formattedDate = lastDayDate.toLocaleDateString('se-SE', options); The output of console.log(formattedDate) is something like:…

VIEW QUESTION
Back To Top
Search