0

I need to change the format of a date I get,

Ex:

2020-12-31T00:00:00

Into

Dec-31-2020

Mat Mol
  • 45
  • 8

1 Answers1

0

let date = new Date()

let day = date.getDate()
let month = date.getMonth() + 1
let year = date.getFullYear()

if(month < 10){
  console.log(`${day}/0${month}/${year}`)
}else{
  console.log(`${day}/${month}/${year}`)
}
Hamada
  • 1,244
  • 2
  • 7
  • 21