0

I have a chart that's giving me this date:

1577612800000

I need to convert it to "ddmmyy" format

I found this:

var timestamp = 1577612800000;                 
var date = new Date(timestamp * 1000);

But it has no format.

How can I do this with format ddmmyy ?

1 Answers1

1

Get values from Date object and generate the string by concatenation.

var timestamp = 1577612800000;
var date = new Date(timestamp);
console.log(
  date.getDate() + '' + (date.getMonth()+1) + date.getFullYear()
)
Pranav C Balan
  • 113,687
  • 23
  • 165
  • 188