Luxon formatting to 2020-08-21 AM 9:19:11

less than 1 minute read

Luxon is a small version of Moment. Let’s get it.

const DateTime = luxon.DateTime;
const date = DateTime.fromISO('2020-08-20 16:00:11.727')
const newDate = date.toFormat('yyyy-MM-dd a h:mm:ss')
console.log(newDate) // 2020-08-20 PM 4:00:11

That’s all.

Leave a comment