In my JavaScript project, I am attempting to adjust the date format to a specific style.
The format I aim for is 29-Jan-2021
.
Currently, with the code below, I can generate "29 Jan 2021"
:
var newDate = new Date('2021-01-29T12:18:48.6588096Z')
const options = {
year: 'numeric',
month: 'short',
day: 'numeric',
};
console.log(newDate.toLocaleString('en-UK', options))
Could someone lend me a hand in adding -
between the day, month, & year components of the date mentioned above?