9951 explained code solutions for 126 technologies


nodejsHow to convert unix timestamp to local date/time


const date = new Date( 1660209124 * 1000 );
const dt = date.toLocaleDateString() + ' ' + date.toLocaleTimeString();ctrl + c
new Date

create date/time management object

1660209124

sample timestamp to convert to date

* 1000

convert given timestamp from seconds to milliseconds

toLocaleDateString

returns locally formatted date string

toLocaleTimeString

returns locally formatted time string