P
P
Petr Volkhanov2017-05-01 23:28:34
JavaScript
Petr Volkhanov, 2017-05-01 23:28:34

How to convert a timestamp to a date like mm.dd.yyyy?

How to convert a timestamp (it looks like this - 1497094200000) into a date like mm.dd.yyyy?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dummyman, 2017-05-02
@eprivalov

console.log( new Date( 1497094200000 ) );

("" + (new Date(1497094200000)).toISOString())
        .replace(/^([^T]+)T(.+)$/,'$1')
        .replace(/^(\d+)-(\d+)-(\d+)$/,'$3.$2.$1')

"10.06.2017"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question