Convert an ISO date string to local date string in JavaScript

You, javascript

🤔 Problem

We need to convert the following ISO-8601 date format:


To our locale format*:

“17/03/2021 11:23:00”

* in this case, our locale is UK


const date = '2021-03-17T11:23'

const convertedDate = new Date(date).toLocaleString()

console.log(convertedDate) // “17/03/2021 11:23:00”

💡 Extra Tip

As above, the toLocaleString() method will return your current locale by default. If you want to specify the locale, simply pass in your chosen locale and any other options:

const koreaDate = newDate(date).toLocaleString('ko-KR', { timeZone: 'UTC' })

// expected output: 2012. 12. 20. 오전 3:00:00

Check out the MDN documentation for further info and examples.

© Samuel Jones.RSS